Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
just another issue related to 'strict_undefined'
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
George Xie  
View profile  
 More options Nov 6 2012, 3:12 pm
From: George Xie <george...@gmail.com>
Date: Tue, 6 Nov 2012 12:12:39 -0800 (PST)
Local: Tues, Nov 6 2012 3:12 pm
Subject: just another issue related to 'strict_undefined'

hi all

consider following template

from mako.template import Template

t = Template(
"""
<%
l = l

%>
""".strip(),
strict_undefined=True,
)
print t.render(l=l)

would raise "NameError: name 'l' is not defined"

mako thought 'l' is locally_declared, is this a bug or feature?
I think this is caused by scope rule simulation,
say that though 'l' actually in function scope of render_body, where 'l'
could be get from render context,
but in fact it is in the logical global scope, which is mimicked by mako,
therefore mako wont try to exact 'l' from context.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Bayer  
View profile  
 More options Nov 6 2012, 4:16 pm
From: Michael Bayer <mike...@zzzcomputing.com>
Date: Tue, 6 Nov 2012 16:17:03 -0500
Local: Tues, Nov 6 2012 4:17 pm
Subject: Re: [Mako] just another issue related to 'strict_undefined'

this is not valid Python, so I'm not sure what feature you'd be looking for here:

>>> l = 'hi'
>>> def foo():

...     l = l
...
>>> foo()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in foo
UnboundLocalError: local variable 'l' referenced before assignment


On Nov 6, 2012, at 3:12 PM, George Xie wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
George Xie  
View profile  
 More options Nov 6 2012, 5:24 pm
From: George Xie <george...@gmail.com>
Date: Tue, 6 Nov 2012 14:24:30 -0800 (PST)
Local: Tues, Nov 6 2012 5:24 pm
Subject: Re: [Mako] just another issue related to 'strict_undefined'

okay, I get it.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »