diff --git a/CHANGES b/CHANGES index 465380fa7119c2100590f2001477e016e96e0971..254f67561c4581da0d94fa98c9bd4c7f5fe19e88 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,8 @@ - AST parsing, properly detects imports of the form "import foo.bar" [ticket:27] - fix to lexing of <%docs> tag nested in other tags +- fix to context-arguments inside of <%include> tag which broke +during 0.1.4 [ticket:29] 0.1.4 - got defs-within-defs to be cacheable diff --git a/lib/mako/parsetree.py b/lib/mako/parsetree.py index 3e38e981dfa58577b756489f144c8f8fa47d227d..aef13888fc6618ba8c5fb102842c93a815430c7e 100644 --- a/lib/mako/parsetree.py +++ b/lib/mako/parsetree.py @@ -224,7 +224,8 @@ class IncludeTag(Tag): def declared_identifiers(self): return [] def undeclared_identifiers(self): - return self.page_args.undeclared_identifiers + identifiers = self.page_args.undeclared_identifiers + return identifiers.union(super(IncludeTag, self).undeclared_identifiers()) class NamespaceTag(Tag): __keyword__ = 'namespace' diff --git a/test/template.py b/test/template.py index 9e3f0d627722071b77c1c7b25aee7d7daebc8824..82952d5fcce23f4fc75993d97629d14dc01cfce6 100644 --- a/test/template.py +++ b/test/template.py @@ -202,6 +202,17 @@ class IncludeTest(unittest.TestCase): """) 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): + lookup = TemplateLookup() + lookup.put_string("a", """ + this is a + <%include file="${i}" args="c=5, **context.kwargs"/> + """) + lookup.put_string("b", """ + <%page args="a,b,c"/> + this is b. ${a}, ${b}, ${c} + """) + assert flatten_result(lookup.get_template("a").render(a=7,b=8,i='b')) == "this is a this is b. 7, 8, 5" class ControlTest(unittest.TestCase): def test_control(self):