"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Cheetah/Tools/turbocheetah/cheetahsupport.py" between
cheetah3-3.2.0.tar.gz and cheetah3-3.2.1.tar.gz

About: Cheetah3 is a template engine and code generation tool for e.g. for Web development or Java, SQL, LaTeX, form email ... (written in Python).

cheetahsupport.py  (cheetah3-3.2.0):cheetahsupport.py  (cheetah3-3.2.1)
"Template support for Cheetah" "Template support for Cheetah"
import imp
import os import os
import pkg_resources
import sys import sys
from Cheetah import Compiler from Cheetah import Compiler
import pkg_resources from Cheetah.compat import new_module
def _recompile_template(package, basename, tfile, classname): def _recompile_template(package, basename, tfile, classname):
tmpl = pkg_resources.resource_string(package, "%s.tmpl" % basename) tmpl = pkg_resources.resource_string(package, "%s.tmpl" % basename)
c = Compiler.Compiler(source=tmpl, mainClassName='GenTemplate') c = Compiler.Compiler(source=tmpl, mainClassName='GenTemplate')
code = str(c) code = str(c)
mod = imp.new_module(classname) mod = new_module(classname)
ns = dict() ns = dict()
exec(code, ns) exec(code, ns)
tempclass = ns.get("GenTemplate", tempclass = ns.get("GenTemplate",
ns.get('DynamicallyCompiledCheetahTemplate')) ns.get('DynamicallyCompiledCheetahTemplate'))
assert tempclass assert tempclass
tempclass.__name__ = basename tempclass.__name__ = basename
setattr(mod, basename, tempclass) setattr(mod, basename, tempclass)
sys.modules[classname] = mod sys.modules[classname] = mod
return mod return mod
 End of changes. 4 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)