New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<%include file="${i}"/> broken as of r228 #29

Closed
sqlalchemy-bot opened this Issue Mar 25, 2007 · 2 comments

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented Mar 25, 2007

Migrated issue, originally created by Anonymous

We have the following template on PylonsHQ:

<%include file="/docs/${g.current_version}/install.html"/>
<%def name="title()">${parent.title()} - Install</%def>
<%def name="nav()">Install</%def>
<%inherit file="/layout.html"/>

As of r228, the include is broken with the error:

I keep getting this wack error
Module _layout_html:59 in render_body
>>  context.write(unicode(self.yui_grid()))
Module mako.runtime:200 in <lambda>
>>  return lambda *args, **kwargs:callable_(self.context, *args, **kwargs)
Module _layout_html:100 in render_yui_grid
>>  context.write(unicode(caller.body()))
Module mako.runtime:91 in call_wno_caller
>>  return callable_(*args, **kwargs)
Module _layout_html:51 in body
>>  context.write(unicode(next.body()))
Module mako.runtime:200 in <lambda>
>>  return lambda *args, **kwargs:callable_(self.context, *args, **kwargs)
Module _install_index_html:26 in render_body
>>  runtime._include_file(context, u'/docs/' + g.current_version + u'/install.html', _template_uri)
NameError: global name 'g' is not defined

The .py generated for this file as of r228 is:

def render_body(context,**pageargs):
    __locals = dict(pageargs=pageargs)
    foo = context.get('foo', UNDEFINED)
    # SOURCE LINE 1
    runtime._include_file(context, u'/docs/' + g.current_version + u'/install.html', _template_uri)

Whereas before it would do something along the lines of:

def render_body(context,**pageargs):
    __locals = dict(pageargs=pageargs)
    g = context.get('g', UNDEFINED)
    # SOURCE LINE 1
    runtime._include_file(context, u'/docs/' + g.current_version + u'/install.html', _template_uri)

I've attached a test for this and a patch that fixes it. You probably have a better version of the patch -- what it generates now is:

def render_body(context,**pageargs):
    __locals = dict(pageargs=pageargs)
    foo = context.get('foo', UNDEFINED)
    g = context.get('g', UNDEFINED)
    # SOURCE LINE 1
    runtime._include_file(context, u'/docs/' + g.current_version + u'/install.html', _template_uri)

I suspect the 'foo' PythonCode business is some test code you left around in the r228 commit


Attachments: include_fix_r240.diff

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Mar 26, 2007

Michael Bayer (@zzzeek) wrote:

patch is in [changeset:241]. [changeset:242] I added some stuff to filter out the "fake" function name "foo" (which is now the less likely "__DUMMY"). that is needed at the moment because i am using straight AST to parse out the list of arguments and AST needs to see "oh, its a callable".

0.1.5 is definitely due now will try to get it out today/tomorrow.

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Mar 26, 2007

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment