page arguments don't work with inherited templates

Issue #116 resolved
Michael Bayer
repo owner created an issue


  1. TEMPLATE "test.tmpl" <%inherit file="base.tmpl" /> <%page args="variable" /> ${variable}
  1. TEMPLATE "base.tmpl" <%page args="bar" /> ${bar} ${pageargs['foo']}

a proposed fix is:

def _kwargs_for_callable(callable_, data, kwargs): data.update(kwargs) if 'context' in data: del data['context'] return data

though I'd like to see if this can be addressed in a more fundamental way.

Comments (7)

  1. guest


    That was my original proposal, but I did something else.

    I simply removed the call to '_kwargs_for_callable' in _render. Now the only place that calls _kwargs_for_callable is in _render_context.

    --- a/libraries/Mako-0.2.4/lib/mako/ Fri Jul 31 13:14:13 2009 -0700 +++ b/libraries/Mako-0.2.4/lib/mako/ Mon Aug 17 21:06:58 2009 -0700 @@ -344,14 +344,16 @@ buf = util.StringIO() context = Context(buf, data) context._with_template = template - _render_context(template, callable_, context, *args, _kwargs_for_callable(callable_, data)) + _render_context(template, callable_, context, *args, data) return context._pop_buffer().getvalue()

    - Jae

  2. Michael Bayer reporter
    • changed milestone to 0.3

    i need to evaluate how the change to <%include> feels and if it seems like it could be confusing and/or break existing code in a difficult way. 0.3 is good here for a modest behavioral change.

  3. Log in to comment