def loadTemplate(self, path, module, args): if fileExists(getViewsPath(path + ".py")) or fileExists(getViewsPath(path + ".pyo")): if fileExists(getViewsPath(path + ".pyo")): template = imp.load_compiled(module, getViewsPath(path + ".pyo")) else: template = imp.load_source(module, getViewsPath(path + ".py")) mod = getattr(template, module, None) if callable(mod): return str(mod(searchList=args)) elif fileExists(getViewsPath(path + ".tmpl")): return str(Template(file=getViewsPath(path + ".tmpl"), searchList=[args])) return None