On Fri, 2006-08-04 at 10:09 -0700, Ahmad Alhashemi wrote:
[...]
> The problem here is that the base and extending templates are not
> always managed by the same person.
>
> Consider the case of the admin templates for example. Sometimes you
> just want to create your own base template to change the general theme,
> but you want to leave the remaining admin templates unchanged. Now if
> you apply autoescaping to your base template, all the extending admin
> templates will become broken and need to be changed to work properly.
>
> This also applies to larger scopes, like when you download several
> applications from the Internet, each with their own default set of
> templates, you put them in a single project and you make them all
> extend a common template that provides the basic functionality for your
> site. Now if some of them are designed to work with autoescaping "on"
> and others are designed for autoescaping turned "off", there won't be a
> correct elegant solution to the problem.
Actually this is not as big a problem as it appears. The way template
inheritance works in Django is that you can only extend things inside a
{% block %}...{% endblock %} section. So you are already having to know
about the base template in order to extend it (which blocks does it
supply). As part of that knowledge, you should find out if the blocks
are auto-escaped. It's just not that much extra work.
We already have some suggested practices for designing sites so that you
can have a site-base.html template for the project and then maybe a
base.html for your app and so on down the chain. They are simply
conventions and we can update the convention to recommend "the content
block should be wrapped in {% autoescape %} ... {% endautoescape %}" so
that apps which follow the convention will still know what is going on.
The interesting problem is the {% include %} tag. :-)
Regards,
Malcolm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---