For a more intuitive understanding of this behavior, consider that HTML 
comments are not excluded from the actual HTML markup -- they are merely 
instructions to the browser to ignore what's inside the comment (i.e., 
don't attempt to render it). The web2py template system generates HTML 
markup (among other things), and because an HTML comment is intended to be 
generated as part of the markup, there is no reason for the template system 
to ignore it. In fact, in some cases you may even need to execute template 
code inside a comment (e.g., it used to be common to wrap Javascript code 
inside an HTML comment tag to accommodate older browsers), so it would not 
be desirable for the template code inside HTML comments to be ignored.

Anthony

On Friday, November 7, 2014 9:03:34 AM UTC-5, Cliff Kachinske wrote:
>
> Code like the following will raise an exception in a view.
>
> {{
> foo='bar'
> # fubar='nothing'
> }}
>
>
> <!-- <input type="text" value="{{=fubar}}"> -->
>
> Even though the html is commented out, Web2py will process it and try to 
> find an object named fubar. Since it's not defined in the view, you get an 
> exception.
>
> I mention this because (a) it's puzzling the first time it happens and (b) 
> it can take some time to figure out what's really going on.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to