Skip to content
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

functions declared in filter="" attributes do not pull from the Context #3

Closed
sqlalchemy-bot opened this issue Dec 22, 2006 · 3 comments
Labels
bug Something isn't working low priority runtime

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by Michael Bayer (@zzzeek)

i.e.

   <%namespace name="foo" file="func.html"/>
   
   <%def name="lala" filter="foo.bar">
      etc
   </%def>

the "foo" namespace will not get pulled out from the Context into the local python namespace.

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • added labels: easy

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

except it does, this must have been duped at some point

from mako.template import Template

t = Template("""
   <%namespace name="foo" file="func.html"/>

   <%def name="lala()" filter="foo.bar">
      etc
   </%def>

""")

print t.code



#!python
def render_body(context,**pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        foo = _mako_get_namespace(context, 'foo')
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n   ')
        # SOURCE LINE 2
        __M_writer(u'\n\n   ')
        # SOURCE LINE 6
        __M_writer(u'\n\n')
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_lala(context):
    __M_caller = context.caller_stack._push_frame()
    try:
        context._push_buffer()
        foo = _mako_get_namespace(context, 'foo')
        __M_writer = context.writer()
        # SOURCE LINE 4
        __M_writer(u'\n      etc\n   ')
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(foo.bar(__M_buf.getvalue()))
    return ''

@sqlalchemy-bot
Copy link
Author

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
Labels
bug Something isn't working low priority runtime
Projects
None yet
Development

No branches or pull requests

1 participant