On Aug 3, 11:10 am, Michael Radziej <[EMAIL PROTECTED]> wrote:
> On Thu, Aug 02, James Bennett wrote:
>
...
> > From the descriptions above -- of using the autoescape toggle in a
> > base template to inherit through to every child template -- it seems
> > that the only logical thing is for it to not be something which
> > "expires" at the end of a block, but instead to apply to an entire
> > template.
>
> > If I've misread that, somebody correct me.
>
> Well, "autoescape" is not a setting, it builds a TemplateNode.
>
> {% autoescape %} always needs an {% endautoescape %}, generating a node
> during template parsing. Everything between {% autoescape %} and {%
> endautoescape %} is put in its subnode list.
>
> If a VariableNode is below an {% autoescape on %} in the template node tree,
> autoescape is in effect, if it is below an {% autoescape off %}, it won't.
> (Deepest autoescape node wins, of course.)
>
> So, it all depends on the node tree, and not at all on the template that
> ultimately defines a block.
>
> By the way, it is also possible to write templates that are completely
> independent of the autoescape setting in effect without using any
> {% autoescape %} filter tag:
>
> - Add an 'escape' filter to each variable that needs escaping
>   (and autoescape will *not* escape it another time)
>
> - Add a 'safe' filter to all the other variables, and it will be marked
>   as safe, so that autoescaping won't touch it.
>
> This actually adds some documentation for any reviewer. 'safe' means:
> "Hey, I haven't simply forgot escaping, I meant it!"

Jacob used the word 'raw' here, which is indeed a more appropriate
name for the "don't escape me" filter.

Niels

>
> Michael
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to