Caanot use 'dict' builtin in templates #84
Closed
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: