def __init__(self, application): ServletFactory.__init__(self, application) setting = application.setting global defaultOutput # the default Kid output method defaultOutput = setting('KidOutputMethod', defaultOutput) global defaultFormat # the default Kid output format defaultFormat = setting('KidOutputFormat', defaultFormat) global defaultExtensions # the default Kid template extensions self._extensions = setting('ExtensionsForKid', defaultExtensions) defaultExtensions = self._extensions self._cacheTemplates = setting('CacheKidTemplates', True) self._useCache = setting('UseKidKitCache', False) if self._useCache: self._cacheSource = setting('CacheKidSource', True) self._clearCache = setting('ClearKidCacheOnStart', False) self._cacheDir = os.path.join(application._cacheDir, 'KidKit') if self._clearCache: self.clearFileCache() else: self._cacheSource = self._clearCache = False self._cacheDir = None t = ['_'] * 256 from string import digits, letters for c in digits + letters: t[ord(c)] = c self._classNameTrans = ''.join(t)
def __init__(self, application): ServletFactory.__init__(self, application) self._cacheDir = os.path.join(application._cacheDir, 'PSP') sys.path.append(self._cacheDir) self._cacheClassFiles = self._cacheClasses t = ['_'] * 256 from string import digits, letters for c in digits + letters: t[ord(c)] = c self._classNameTrans = ''.join(t) if application.setting('ClearPSPCacheOnStart', 0): self.clearFileCache()
def __init__(self, application): ServletFactory.__init__(self, application) self._cacheDir = os.path.join(application._cacheDir, 'PSP') sys.path.append(self._cacheDir) self._cacheClassFiles = self._cacheClasses t = ['_'] * 256 for c in digits + letters: t[ord(c)] = c self._classNameTrans = ''.join(t) setting = application.setting self._extensions = setting('ExtensionsForPSP', ['.psp']) self._fileEncoding = setting('PSPFileEncoding', None) if setting('ClearPSPCacheOnStart', False): self.clearFileCache() self._recordFile = application._imp.recordFile
def __init__(self,application): ServletFactory.__init__(self,application) self.cacheDir = application.serverSidePath('Cache/PSP') self._classcache={} sys.path.append(self.cacheDir) self._cacheClassFiles = self._cacheClasses l = ['_'] * 256 for c in string.digits + string.letters: l[ord(c)] = c self._classNameTrans = string.join(l, '') if application.setting('ClearPSPCacheOnStart', 1): self.clearFileCache() self._lock = threading.RLock()
def flushCache(self): """Clean out the cache of classes in memory and on disk.""" ServletFactory.flushCache(self) self.clearFileCache()