diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-11-15 19:20:31 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-11-15 19:20:31 +0000 |
commit | 718d98eec9e3f75faf751d130510a46ade630b80 (patch) | |
tree | f47d0ee7ecd586050c2a632bb1b8ddf2f14f8fec /lib/mako/codegen.py | |
parent | 22d59fe72c2ca2586e3499df71be39d406b7fff6 (diff) | |
download | external_python_mako-718d98eec9e3f75faf751d130510a46ade630b80.tar.gz external_python_mako-718d98eec9e3f75faf751d130510a46ade630b80.tar.bz2 external_python_mako-718d98eec9e3f75faf751d130510a46ade630b80.zip |
- the <%namespacename:defname> syntax described at
http://techspot.zzzeek.org/?p=28 has now
been added as a built in syntax, and is recommended
as a more modern syntax versus <%call expr="expression">.
The %call tag itself will always remain,
with <%namespacename:defname> presenting a more HTML-like
alternative to calling defs, both plain and
nested. Many examples of the new syntax are in the
"Calling a def with embedded content" section
of the docs.
Diffstat (limited to 'lib/mako/codegen.py')
-rw-r--r-- | lib/mako/codegen.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/mako/codegen.py b/lib/mako/codegen.py index 0f1be99..f02b8de 100644 --- a/lib/mako/codegen.py +++ b/lib/mako/codegen.py @@ -528,6 +528,12 @@ class _GenerateRenderMethod(object): def visitDefTag(self, node): pass + def visitCallNamespaceTag(self, node): + # TODO: we can put namespace-specific checks here, such + # as ensure the given namespace will be imported, + # pre-import the namespace, etc. + self.visitCallTag(node) + def visitCallTag(self, node): self.printer.writeline("def ccall(caller):") export = ['body'] @@ -583,7 +589,7 @@ class _GenerateRenderMethod(object): "try:") self.write_source_comment(node) self.printer.writelines( - "__M_writer(%s)" % self.create_filter_callable([], node.attributes['expr'], True), + "__M_writer(%s)" % self.create_filter_callable([], node.expression, True), "finally:", "context.caller_stack.nextcaller = None", None @@ -680,7 +686,10 @@ class _Identifiers(object): for ident in node.declared_identifiers(): self.argument_declared.add(ident) self.check_declared(node) - + + def visitCallNamespaceTag(self, node): + self.visitCallTag(node) + def visitCallTag(self, node): if node is self.node: for ident in node.undeclared_identifiers(): |