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

Caanot use 'dict' builtin in templates #84

Closed
sqlalchemy-bot opened this issue May 30, 2008 · 2 comments
Closed

Caanot use 'dict' builtin in templates #84

sqlalchemy-bot opened this issue May 30, 2008 · 2 comments
Labels
bug Something isn't working low priority runtime

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by Anonymous

In r375 there has been added a patch to allow the use of Python builtin names as template variables. I use the 'dict' builtin in several templates to make a dictionary, but with this patch the compiled template begins with the lines:

from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
_magic_number = 2
...

def render_body(context,**pageargs):
context.caller_stack._push_frame()
try:
__M_locals = dict(pageargs=pageargs)
dict = context.get('dict', UNDEFINED)
...

(ellipsis omitting rest of code)

and, on render time, Python complains with an UnboundLocalError: "local variable 'dict' referenced before assignment" due to the use of dict in the _M_locals line (just before trying to pull from
the context).

Regards,

Raúl García

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

thanks for keeping on trunk, this is fixed in 4a63492.

@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