diff options
author | Philip Jenvey <pjenvey@underboss.org> | 2008-04-11 22:41:20 +0000 |
---|---|---|
committer | Philip Jenvey <pjenvey@underboss.org> | 2008-04-11 22:41:20 +0000 |
commit | c166f9aef7e9540f21bf668e0b68c4bbfff93f92 (patch) | |
tree | 4d553342ecb5419f32d7681a32398a5ccc701a07 /lib/mako/template.py | |
parent | a0367f0de781472bf2c960c8d04b2f22f09f55a5 (diff) | |
download | external_python_mako-c166f9aef7e9540f21bf668e0b68c4bbfff93f92.tar.gz external_python_mako-c166f9aef7e9540f21bf668e0b68c4bbfff93f92.tar.bz2 external_python_mako-c166f9aef7e9540f21bf668e0b68c4bbfff93f92.zip |
merge branches/_ast r340:HEAD, minus r344, to trunk. adds support for parsing
python via _ast and google app engine
Diffstat (limited to 'lib/mako/template.py')
-rw-r--r-- | lib/mako/template.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/mako/template.py b/lib/mako/template.py index 36e4d43..aca51cd 100644 --- a/lib/mako/template.py +++ b/lib/mako/template.py @@ -10,8 +10,7 @@ as well as template runtime operations.""" from mako.lexer import Lexer from mako import codegen from mako import runtime, util, exceptions -import imp, time, weakref, tempfile, shutil, os, stat, sys, re - +import imp, os, re, shutil, stat, sys, tempfile, time, types, weakref class Template(object): @@ -205,7 +204,9 @@ def _compile_text(template, text, filename): source = codegen.compile(node, template.uri, filename, default_filters=template.default_filters, buffer_filters=template.buffer_filters, imports=template.imports, source_encoding=lexer.encoding, generate_unicode=not template.disable_unicode) #print source cid = identifier - module = imp.new_module(cid) + if isinstance(cid, unicode): + cid = cid.encode() + module = types.ModuleType(cid) code = compile(source, cid, 'exec') exec code in module.__dict__, module.__dict__ return (source, module) |