Hi, I like to use TEMPLATE_STRING_IF_INVALID with <font color="red">%s</font>, however such usage is discouraged. I think that in production mode it's better to put no item into HTML instead of 500 error in most of cases. But there might be a method to mail admins somehow for important fields having broken. If TEMPLATE_STRING_IF_INVALID is able to show its string, you can make a code to scream about error or mail admins or whatever. I bet you don't ever need to patch django for this (maybe just monkeypatch a bit). Or, as an alternative, use unit testing to get rid of such problems as you have experienced. It's considered good practice for dynamic-typed languages (django templates plus views using them are dynamic-typed, right?)
On Wed, May 14, 2008 at 8:58 PM, Simon Willison <[EMAIL PROTECTED]> wrote: > > Hi all, > > Some time in late 2003, Adrian and I decided that errors in templates > were best handled silently - the idea was that it would prevent > untrained template editors from being able to 500-error a site with a > typo. > > Is it too late to reconsider this decision, four and a half years > later? I can't think of a single time this feature has helped me, and > plenty of examples of times that it has tripped me up. > > Today's example: a <form action=""> tag that shouldn't have been > blank. The code looked like this: > > <form action="{% url something-with-a-typo %}"> > > If you look at Django's URL tag implementation, you can see why: > > http://code.djangoproject.com/browser/django/trunk/django/template/defaulttags.py?rev=6996#L364 > > The code catches the NoReverseMatch exception and silences it, > outputting an empty string instead. > > Silent errors are bad. If we were to remove them, how much of a > negative impact would it have on the existing user base? > > Cheers, > > Simon > > > > > > -- Best regards, Yuri V. Baburov, ICQ# 99934676, Skype: yuri.baburov, MSN: [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---