PK’.5?z¢†\\EGG-INFO/entry_points.txt [python.templating.engines] cheetah = turbocheetah.cheetahsupport:TurboCheetah PK÷‘.5“×2EGG-INFO/not-zip-safe PK’.5®îØLJJEGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: TurboCheetah Version: 0.9.5 Summary: TurboGears plugin to support use of Cheetah templates. Home-page: http://www.turbogears.org/docs/plugins/template.html Author: Kevin Dangoor Author-email: dangoor+turbogears@gmail.com License: MIT Download-URL: http://www.turbogears.org/download/ Description: This template plugin can be used with TurboGears or Buffet. The development version is here: http://www.turbogears.org/svn/turbogears/trunk/plugins/cheetah/#egg=TurboCheetah-dev Keywords: python.templating.engines,turbogears Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: License :: OSI Approved :: MIT License Classifier: Topic :: Software Development :: Libraries :: Python Modules PK’.5زlžEGG-INFO/requires.txtCheetah >= 1.0PK’.5faêóEGG-INFO/SOURCES.txtREADME.txt setup.cfg setup.py TurboCheetah.egg-info/PKG-INFO TurboCheetah.egg-info/SOURCES.txt TurboCheetah.egg-info/entry_points.txt TurboCheetah.egg-info/not-zip-safe TurboCheetah.egg-info/requires.txt TurboCheetah.egg-info/top_level.txt turbocheetah/__init__.py turbocheetah/cheetahsupport.py turbocheetah/tests/__init__.py turbocheetah/tests/import_inherit.tmpl turbocheetah/tests/inherit_from.tmpl turbocheetah/tests/simple1.tmpl turbocheetah/tests/test_template.py turbocheetah/tests/sub/master.tmpl turbocheetah/tests/sub/page.tmpl turbocheetah/tests/sub/page_over.tmpl turbocheetah/tests/sub/page_template_over.tmpl turbocheetah/tests/sub/template.tmpl turbocheetah/tests/sub/template_over.tmpl turbocheetah/tests/sub2/page_over.tmpl turbocheetah/tests/sub2/template_over.tmpl PK’.5Š96 EGG-INFO/top_level.txtturbocheetah PK·‘.5g”u3ooturbocheetah/__init__.pyfrom turbocheetah import cheetahsupport TurboCheetah = cheetahsupport.TurboCheetah __all__ = ["TurboCheetah"]PK’.5V’°XRRturbocheetah/__init__.pyc;ò Ô Ec@s#dklZeiZdgZdS((scheetahsupports TurboCheetahN(s turbocheetahscheetahsupports TurboCheetahs__all__(scheetahsupports TurboCheetahs__all__((sEbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbocheetah/__init__.pys?s  PK·‘.5ƒ?Ú7ppturbocheetah/cheetahsupport.py"Template support for Cheetah" import sys, os, imp from Cheetah import Compiler import pkg_resources def _recompile_template(package, basename, tfile, classname): tmpl = pkg_resources.resource_string(package, "%s.tmpl" % basename) c = Compiler.Compiler(source=tmpl, mainClassName='GenTemplate') code = str(c) mod = imp.new_module(classname) ns = dict() exec code in ns tempclass = ns.get("GenTemplate", ns.get('DynamicallyCompiledCheetahTemplate')) assert tempclass tempclass.__name__ = basename setattr(mod, basename, tempclass) sys.modules[classname] = mod return mod class TurboCheetah: extension = "tmpl" def __init__(self, extra_vars_func=None, options=None): if options is None: options = dict() self.get_extra_vars = extra_vars_func self.options = options self.compiledTemplates = {} self.search_path = [] def load_template(self, template=None, template_string=None, template_file=None, loadingSite=False): """Searches for a template along the Python path. Template files must end in ".tmpl" and be in legitimate packages. """ given = len(filter(None, (template, template_string, template_file))) if given > 1: raise TypeError( "You may give only one of template, template_string, and " "template_file") if not given: raise TypeError( "You must give one of template, template_string, or " "template_file") if template: return self.load_template_module(template) elif template_string: return self.load_template_string(template_string) elif template_file: return self.load_template_file(template_file) def load_template_module(self, classname): ct = self.compiledTemplates divider = classname.rfind(".") if divider > -1: package = classname[0:divider] basename = classname[divider+1:] else: raise ValueError, "All templates must be in a package" if not self.options.get("cheetah.precompiled", False): tfile = pkg_resources.resource_filename(package, "%s.%s" % (basename, self.extension)) if ct.has_key(classname): mtime = os.stat(tfile).st_mtime if ct[classname] != mtime: ct[classname] = mtime del sys.modules[classname] mod = _recompile_template(package, basename, tfile, classname) else: mod = __import__(classname, dict(), dict(), [basename]) else: ct[classname] = os.stat(tfile).st_mtime mod = _recompile_template(package, basename, tfile, classname) else: mod = __import__(classname, dict(), dict(), [basename]) tempclass = getattr(mod, basename) return tempclass def load_template_string(self, content): raise NotImplementedError def load_template_file(self, filename): raise NotImplementedError def render(self, info, format="html", fragment=False, template=None, template_string=None, template_file=None): tclass = self.load_template( template=template, template_string=template_string, template_file=template_file) if self.get_extra_vars: extra = self.get_extra_vars() else: extra = {} tempobj = tclass(searchList=[info, extra]) return str(tempobj) PK’.5ÄÒ(ø‡‡turbocheetah/cheetahsupport.pyc;ò Ô Ec@sWdZdkZdkZdkZdklZdkZd„Zdfd„ƒYZdS(sTemplate support for CheetahN(sCompilerc Bs±ei|d|ƒ}eid|ddƒ}e|ƒ}e i |ƒ} e ƒ}||U|id|idƒƒ}|pt‚||_e| ||ƒ| ei|<| SdS(Ns%s.tmplssources mainClassNames GenTemplates"DynamicallyCompiledCheetahTemplate(s pkg_resourcessresource_stringspackagesbasenamestmplsCompilerscsstrscodesimps new_modules classnamesmodsdictsnssgets tempclasssAssertionErrors__name__ssetattrssyssmodules( spackagesbasenamestfiles classnamestmplscscodes tempclasssnssmod((sKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbocheetah/cheetahsupport.pys_recompile_templates     s TurboCheetahcBsetZdZeed„Zeeeed„Zd„Zd„Zd„Z deeeed„Z RS( NstmplcCsB|tjo tƒ}n||_||_h|_g|_dS(N(soptionssNonesdictsextra_vars_funcsselfsget_extra_varsscompiledTemplatess search_path(sselfsextra_vars_funcsoptions((sKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbocheetah/cheetahsupport.pys__init__s      cCsŸttt|||fƒƒ}|djotdƒ‚n| otdƒ‚n|o|i |ƒSn1|o|i |ƒSn|o|i |ƒSndS(s‚Searches for a template along the Python path. Template files must end in ".tmpl" and be in legitimate packages. isEYou may give only one of template, template_string, and template_files@You must give one of template, template_string, or template_fileN( slensfiltersNonestemplatestemplate_strings template_filesgivens TypeErrorsselfsload_template_modulesload_template_stringsload_template_file(sselfstemplatestemplate_strings template_files loadingSitesgiven((sKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbocheetah/cheetahsupport.pys load_template"s c Csi|i} |idƒ}|djo|d|!}||d}n td‚|i i dt ƒ oÐt i |d||ifƒ}| i|ƒorti|ƒi}| ||jo-|| |