def __init__(self): self.redownloadingWhitelist = False self.startRedownload = datetime.datetime.now() self.endRedownload = datetime.datetime.now() self.percentDownloaded = 0.0 self.notify = DirectNotifyGlobal.directNotify.newCategory('TTWhiteList') vfs = VirtualFileSystem.getGlobalPtr() filename = Filename('twhitelist.dat') searchPath = DSearchPath() if AppRunnerGlobal.appRunner: searchPath.appendDirectory(Filename.expandFrom('$TT_3_ROOT/phase_3/etc')) else: searchPath.appendDirectory(Filename('.')) searchPath.appendDirectory(Filename('etc')) searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('$TOONTOWN/src/chat'))) searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('toontown/src/chat'))) searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('toontown/chat'))) found = vfs.resolveFilename(filename, searchPath) if not found: self.notify.info("Couldn't find whitelist data file!") data = vfs.readFile(filename, 1) lines = data.split('\n') WhiteList.__init__(self, lines) self.redownloadWhitelist() self.defaultWord = TTLocalizer.ChatGarblerDefault[0] self.accept('updateWhitelist', self.handleNewWhitelist)
def __init__(self): vfs = VirtualFileSystem.getGlobalPtr() filename = Filename('pwhitelist.txt') searchPath = DSearchPath() if AppRunnerGlobal.appRunner: searchPath.appendDirectory( Filename.expandFrom('$POTCO_WL_ROOT/etc')) else: searchPath.appendDirectory(Filename('.')) searchPath.appendDirectory(Filename('etc')) searchPath.appendDirectory( Filename.fromOsSpecific( os.path.expandvars('$PIRATES/src/chat'))) searchPath.appendDirectory( Filename.fromOsSpecific( os.path.expandvars('pirates/src/chat'))) searchPath.appendDirectory( Filename.fromOsSpecific(os.path.expandvars('pirates/chat'))) found = vfs.resolveFilename(filename, searchPath) if not found: message = 'pwhitelist.txt file not found on %s' % searchPath raise IOError, message data = vfs.readFile(filename, 1) lines = data.split('\n') for token in enumeratePirateNameTokensLower(): lines.append(token) WhiteList.__init__(self, lines)
def __init__(self): self.redownloadingWhitelist = False self.startRedownload = datetime.datetime.now() self.endRedownload = datetime.datetime.now() self.percentDownloaded = 0.0 self.notify = DirectNotifyGlobal.directNotify.newCategory("TTWhiteList") vfs = VirtualFileSystem.getGlobalPtr() filename = Filename("twhitelist.dat") searchPath = DSearchPath() searchPath.appendDirectory(Filename("/phase_4/etc")) found = vfs.resolveFilename(filename, searchPath) if not found: self.notify.info("Couldn't find whitelist data file!") data = vfs.readFile(filename, 1) lines = data.split("\n") WhiteList.__init__(self, lines) if self.WhitelistOverHttp: self.redownloadWhitelist() self.defaultWord = TTLocalizer.ChatGarblerDefault[0]
def __init__(self): self.redownloadingWhitelist = False self.startRedownload = datetime.datetime.now() self.endRedownload = datetime.datetime.now() self.percentDownloaded = 0.0 self.notify = DirectNotifyGlobal.directNotify.newCategory('TTWhiteList') vfs = VirtualFileSystem.getGlobalPtr() filename = Filename('twhitelist.dat') searchPath = DSearchPath() if __debug__: searchPath.appendDirectory(Filename('resources/phase_3/etc')) found = vfs.resolveFilename(filename, searchPath) if not found: self.notify.info("Couldn't find whitelist data file!") data = vfs.readFile(filename, 1) lines = data.split(b'\n') WhiteList.__init__(self, lines) self.redownloadWhitelist() self.defaultWord = TTLocalizer.ChatGarblerDefault[0] self.accept('updateWhitelist', self.handleNewWhitelist)
def __init__(self): vfs = VirtualFileSystem.getGlobalPtr() filename = Filename('pwhitelist.txt') searchPath = DSearchPath() if __debug__: searchPath.appendDirectory( Filename.expandFrom('../resources/phase_3/etc')) else: searchPath.appendDirectory(Filename.expandFrom('phase_3/etc')) found = vfs.resolveFilename(filename, searchPath) if not found: message = 'pwhitelist.txt file not found on %s' % searchPath raise IOError, message data = vfs.readFile(filename, 1) lines = data.split('\n') for token in enumeratePirateNameTokensLower(): lines.append(token) WhiteList.__init__(self, lines)
def __init__(self): """ self.redownloadingWhitelist = False self.startRedownload = datetime.datetime.now() self.endRedownload = datetime.datetime.now() self.percentDownloaded = 0.0 self.notify = DirectNotifyGlobal.directNotify.newCategory('PWhiteList') vfs = VirtualFileSystem.getGlobalPtr() filename = Filename('pwhitelist.dat') searchPath = DSearchPath() searchPath.appendDirectory(Filename('resources')) found = vfs.resolveFilename(filename, searchPath) if not found: self.notify.info("Couldn't find whitelist data file!") data = vfs.readFile(filename, 1) """ lines = ['Test','Test2']#data.split('\n') WhiteList.__init__(self, lines) #if self.WhitelistOverHttp: # self.redownloadWhitelist() self.defaultWord = 'Yarrr' #TTLocalizer.ChatGarblerDefault[0]
def __init__(self): self.redownloadingWhitelist = False self.startRedownload = datetime.datetime.now() self.endRedownload = datetime.datetime.now() self.percentDownloaded = 0.0 self.notify = DirectNotifyGlobal.directNotify.newCategory( 'TTWhiteList') if not os.path.exists('config/'): os.mkdir('config/') if not os.path.isfile('config/%s' % self.WhitelistFileName): from toontown.chat.WhiteListData import WhiteListData with open('config/%s' % self.WhitelistFileName, 'w') as (data): data.write(WhiteListData) data.close() whitelistFile = open('config/%s' % self.WhitelistFileName) data = whitelistFile.read() whitelistFile.close() lines = data.split('\n') WhiteList.__init__(self, lines) if self.WhitelistOverHttp: self.redownloadWhitelist() self.defaultWord = TTLocalizer.ChatGarblerDefault[0]
def __init__(self): vfs = VirtualFileSystem.getGlobalPtr() filename = Filename('pwhitelist.txt') searchPath = DSearchPath() if AppRunnerGlobal.appRunner: searchPath.appendDirectory(Filename.expandFrom('$POTCO_WL_ROOT/etc')) else: searchPath.appendDirectory(Filename('.')) searchPath.appendDirectory(Filename('etc')) searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('$PIRATES/src/chat'))) searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('pirates/src/chat'))) searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('pirates/chat'))) found = vfs.resolveFilename(filename, searchPath) if not found: message = 'pwhitelist.txt file not found on %s' % searchPath raise IOError, message data = vfs.readFile(filename, 1) lines = data.split('\n') for token in enumeratePirateNameTokensLower(): lines.append(token) WhiteList.__init__(self, lines)
def __init__(self): vfs = VirtualFileSystem.getGlobalPtr() filename = Filename('twhitelist.dat') searchPath = DSearchPath() if AppRunnerGlobal.appRunner: # In the web-publish runtime, it will always be here: searchPath.appendDirectory(Filename.expandFrom('$TT_3_ROOT/phase_3/etc')) else: # In other environments, including the dev environment, look here: searchPath.appendDirectory(Filename('.')) searchPath.appendDirectory(Filename('etc')) searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('$TOONTOWN/src/chat'))) searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('toontown/src/chat'))) searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('toontown/chat'))) found = vfs.resolveFilename(filename,searchPath) if not found: print "Couldn't find whitelist data file!" data = vfs.readFile(filename, 1) lines = data.split("\n") WhiteList.__init__(self,lines) self.defaultWord = TTLocalizer.ChatGarblerDefault[0]
def __init__(self): WhiteList.__init__(self, WhiteListData.WHITELIST) self.defaultWord = TTLocalizer.ChatGarblerDefault[0]