diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-03-26 16:21:35 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-03-26 16:21:35 +0000 |
commit | 273621284508cba20dbb08e94bafa68779fe5c9f (patch) | |
tree | 2c7364aa4b17bfb3e6ef01644b42499b85671147 | |
parent | 9660ace1fc87076eafb301e1694fa8400f6106b9 (diff) | |
download | external_python_mako-273621284508cba20dbb08e94bafa68779fe5c9f.tar.gz external_python_mako-273621284508cba20dbb08e94bafa68779fe5c9f.tar.bz2 external_python_mako-273621284508cba20dbb08e94bafa68779fe5c9f.zip |
filtered out throwaway func name when getting <%include> kwargs
-rw-r--r-- | lib/mako/parsetree.py | 4 | ||||
-rw-r--r-- | test/template.py | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/mako/parsetree.py b/lib/mako/parsetree.py index aef1388..ebed303 100644 --- a/lib/mako/parsetree.py +++ b/lib/mako/parsetree.py @@ -220,11 +220,11 @@ class IncludeTag(Tag): __keyword__ = 'include' def __init__(self, keyword, attributes, **kwargs): super(IncludeTag, self).__init__(keyword, attributes, ('file', 'import', 'args'), (), ('file',), **kwargs) - self.page_args = ast.PythonCode("foo(%s)" % attributes.get('args', ''), self.lineno, self.pos, self.filename) + self.page_args = ast.PythonCode("__DUMMY(%s)" % attributes.get('args', ''), self.lineno, self.pos, self.filename) def declared_identifiers(self): return [] def undeclared_identifiers(self): - identifiers = self.page_args.undeclared_identifiers + identifiers = self.page_args.undeclared_identifiers.difference(util.Set(["__DUMMY"])) return identifiers.union(super(IncludeTag, self).undeclared_identifiers()) class NamespaceTag(Tag): diff --git a/test/template.py b/test/template.py index 82952d5..3627dad 100644 --- a/test/template.py +++ b/test/template.py @@ -200,6 +200,7 @@ class IncludeTest(unittest.TestCase): <%page args="a,b,c"/> this is b. ${a}, ${b}, ${c} """) + print lookup.get_template("a").code assert flatten_result(lookup.get_template("a").render(a=7,b=8)) == "this is a this is b. 7, 8, 5" def test_include_withargs(self): |