On 10/7/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
> On 10/7/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:

> > That setting causes nothing but trouble, it seems. :-(
>
> Indeed. #2384, #2566 are both open bugs that are
> TEMPLATE_STRING_IF_INVALID related. This particular problem appears to
> be #2384.
>
> I have an idea of how to fix this problem in the admin template - I'll
> try to have a look at it tomorrow.

Ok; I've had a look at this - the easy fix I was thinking of won't
work here. I can see a few ways to fix this problem (and, by
extension, the larger TEMPLATE_STRING_IF_INVALID issues) - thinking
out loud for a moment:

1) Expect the user to write {% if obj %}{{ obj }}{% endif %} whenever
they want to explicitly put "" whenever TEMPLATE_STRING_IF_INVALID is
generated. This works, but is longwinded, and redundant once
TEMPLATE_STRING_IF_INVALID is disabled.

2) Remove TEMPLATE_STRING_IF_INVALID. I'm not really in favour of
this, as I have found this settings useful when debugging templates.

3) Introduce a template tag {% ignoreinvalid obj %} (or some better
name) that is the same as {{ obj }}, but ignores INVALID conditions.
While this might be more convenient than (1), it reeks of a special
case; also making filters work, and the interpretation of what a
filter should do if they generate an INVALID condition

4) Introduce a template tag which is the templating equivalent of try:
except pass (i.e., set a flag that disables TEMPLATE_STRING_IF_INVALID
for a part of a template). I'm not sure this is any better than (1),
plus it starts down the bad path of making the template language a
programming language.

5) Document the problem away. Advise users that
TEMPLATE_STRING_IF_INVALID is purely a temporary debugging flag, and
it shouldn't be enabled for prolonged periods, even on a development
server.

(5) is my personal favourite. Opinions? Other suggestions?

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to