aboutsummaryrefslogtreecommitdiffstats
path: root/mako/parsetree.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-01-16 13:02:51 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-01-16 13:02:51 -0500
commit2879f8bcc02d75d256bf7db97251a8708ef2466e (patch)
treeb64ad6ab41312ce66147818802e218a8057e50e7 /mako/parsetree.py
parent3266c0160d9103703400123b81a713db21ccd5be (diff)
downloadexternal_python_mako-2879f8bcc02d75d256bf7db97251a8708ef2466e.tar.gz
external_python_mako-2879f8bcc02d75d256bf7db97251a8708ef2466e.tar.bz2
external_python_mako-2879f8bcc02d75d256bf7db97251a8708ef2466e.zip
- [feature/bug] Can now refer to context variables
within extra arguments to <%block>, <%def>, i.e. <%block name="foo" cache_key="${somekey}">. Filters can also be used in this way, i.e. <%def name="foo()" filter="myfilter"> then template.render(myfilter=some_callable) [ticket:180]
Diffstat (limited to 'mako/parsetree.py')
-rw-r--r--mako/parsetree.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/mako/parsetree.py b/mako/parsetree.py
index 9896dd8..98a8701 100644
--- a/mako/parsetree.py
+++ b/mako/parsetree.py
@@ -431,10 +431,13 @@ class DefTag(Tag):
for c in self.function_decl.defaults:
res += list(ast.PythonCode(c, **self.exception_kwargs).
undeclared_identifiers)
- return res + list(self.filter_args.\
+ return set(res).union(
+ self.filter_args.\
undeclared_identifiers.\
difference(filters.DEFAULT_ESCAPES.keys())
- )
+ ).union(
+ self.expression_undeclared_identifiers
+ )
class BlockTag(Tag):
__keyword__ = 'block'
@@ -487,7 +490,12 @@ class BlockTag(Tag):
return self.body_decl.argnames
def undeclared_identifiers(self):
- return []
+ return (self.filter_args.\
+ undeclared_identifiers.\
+ difference(filters.DEFAULT_ESCAPES.keys())
+ ).union(self.expression_undeclared_identifiers)
+
+
class CallTag(Tag):
__keyword__ = 'call'