ok the default "catchall" at the page level is now **pageargs, useable by the template but otherwise not affected
diff --git a/lib/mako/codegen.py b/lib/mako/codegen.py index 0c538cd..7d659bb 100644 --- a/lib/mako/codegen.py +++ b/lib/mako/codegen.py
@@ -50,10 +50,10 @@ if pagetag is not None: args = pagetag.body_decl.get_argument_expressions() if not pagetag.body_decl.kwargs: - args += ['**_extra_pageargs'] + args += ['**pageargs'] cached = eval(pagetag.attributes.get('cached', 'False')) else: - args = ['**_extra_pageargs'] + args = ['**pageargs'] cached = False buffered = filtered = False self.compiler.pagetag = pagetag @@ -140,6 +140,8 @@ self.printer.writeline("try:") self.identifier_stack.append(self.compiler.identifiers.branch(self.node)) + if not self.in_def and '**pageargs' in args: + self.identifier_stack[-1].argument_declared.add('pageargs') if not self.in_def and (len(self.identifiers.locally_assigned) > 0 or len(self.identifiers.argument_declared)>0): self.printer.writeline("__locals = dict(%s)" % ','.join("%s=%s" % (x, x) for x in self.identifiers.argument_declared))
diff --git a/test/inheritance.py b/test/inheritance.py index 096c7f6..4587467 100644 --- a/test/inheritance.py +++ b/test/inheritance.py
@@ -185,7 +185,8 @@ collection = lookup.TemplateLookup() collection.put_string("base", """ this is the base. - + + pageargs: ${pageargs} <%def name="foo()"> ${next.body(**context.kwargs)} </%def> @@ -199,6 +200,7 @@ """) assert result_lines(collection.get_template('index').render(x=5,y=10)) == [ "this is the base.", + "pageargs: {'y': 10, 'x': 5}", "print 5, 10, 7" ] def test_pageargs_2(self):