parent
df95510043
commit
3d41e250e3
1 changed files with 5 additions and 19 deletions
|
@ -10,7 +10,7 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
|
||||||
RedownloadTaskName = 'RedownloadWhitelistTask'
|
RedownloadTaskName = 'RedownloadWhitelistTask'
|
||||||
WhitelistBaseDir = ConfigVariableString('whitelist-base-dir', '').value
|
WhitelistBaseDir = ConfigVariableString('whitelist-base-dir', '').value
|
||||||
WhitelistStageDir = ConfigVariableString('whitelist-stage-dir', 'whitelist').value
|
WhitelistStageDir = ConfigVariableString('whitelist-stage-dir', 'whitelist').value
|
||||||
WhitelistOverHttp = ConfigVariableBool('whitelist-over-http', True).value
|
WhitelistOverHttp = ConfigVariableBool('whitelist-over-http', False).value
|
||||||
WhitelistFileName = ConfigVariableString('whitelist-filename', 'twhitelist.dat').value
|
WhitelistFileName = ConfigVariableString('whitelist-filename', 'twhitelist.dat').value
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -30,9 +30,10 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
|
||||||
data = vfs.readFile(filename, 1)
|
data = vfs.readFile(filename, 1)
|
||||||
lines = data.split(b'\n')
|
lines = data.split(b'\n')
|
||||||
WhiteList.__init__(self, lines)
|
WhiteList.__init__(self, lines)
|
||||||
self.redownloadWhitelist()
|
|
||||||
self.defaultWord = TTLocalizer.ChatGarblerDefault[0]
|
self.defaultWord = TTLocalizer.ChatGarblerDefault[0]
|
||||||
self.accept('updateWhitelist', self.handleNewWhitelist)
|
if self.WhitelistOverHttp:
|
||||||
|
self.redownloadWhitelist()
|
||||||
|
self.accept('updateWhitelist', self.handleNewWhitelist)
|
||||||
|
|
||||||
def unload(self):
|
def unload(self):
|
||||||
self.ignore('updateWhitelist')
|
self.ignore('updateWhitelist')
|
||||||
|
@ -108,22 +109,7 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
|
||||||
def findWhitelistDir(self):
|
def findWhitelistDir(self):
|
||||||
if self.WhitelistOverHttp:
|
if self.WhitelistOverHttp:
|
||||||
return self.WhitelistStageDir
|
return self.WhitelistStageDir
|
||||||
searchPath = DSearchPath()
|
return None
|
||||||
if AppRunnerGlobal.appRunner:
|
|
||||||
searchPath.appendDirectory(Filename.expandFrom('$TT_3_5_ROOT/phase_3.5/models/news'))
|
|
||||||
else:
|
|
||||||
basePath = os.path.expandvars('$TTMODELS') or './ttmodels'
|
|
||||||
searchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/built/' + self.NewsBaseDir))
|
|
||||||
searchPath.appendDirectory(Filename(self.NewsBaseDir))
|
|
||||||
pfile = Filename(self.WhitelistFileName)
|
|
||||||
found = vfs.resolveFilename(pfile, searchPath)
|
|
||||||
if not found:
|
|
||||||
self.notify.warning('findWhitelistDir - no path: %s' % self.WhitelistFileName)
|
|
||||||
self.setErrorMessage(TTLocalizer.NewsPageErrorDownloadingFile % self.WhitelistFileName)
|
|
||||||
return None
|
|
||||||
self.notify.debug('found whitelist file %s' % pfile)
|
|
||||||
realDir = pfile.getDirname()
|
|
||||||
return realDir
|
|
||||||
|
|
||||||
def downloadWhitelistTask(self, task):
|
def downloadWhitelistTask(self, task):
|
||||||
if self.ch.run():
|
if self.ch.run():
|
||||||
|
|
Loading…
Reference in a new issue