On Thu, Jul 7, 2011 at 8:37 PM, Tai Lee <[email protected]> wrote: > The docs say that when writing custom template tags, the `render()` > function should never raise `TemplateSyntaxError`, [...]
This rule is the correct one, and I'm very much against changing it. > [...] but some of Django's own template tags (e.g. `widthratio`) don't adhere > to > this policy. These are bugs, and should be fixed. > I'd like to see a move towards consistent exception handling in > templates for template tags and filters. I'd like to see no exceptions > silenced by default, but provide a way for template authors to > conditionally silence exceptions in fragments of their templates. > Perhaps with a block tag. I'm against this, for a whole host of reasons — the crux of which comes down to the philosophy that templates are *not* a programming language, and introducing a try/except concept into them is about seven steps too far. The point of the template language is to give front end designers and developers the space to explore without the persnicketiness a so-called "real" programming language introduces. What you're asking for here is to fundamentally change the philosophy of the template language. If you disagree that fundamentally with the ideas behind the template language I really think you'll be better off finding another one than trying to swim upstream. > Should built-in template tags follow the advice given in the docs, and > never raise `TemplateSyntaxError` in their `render()` function? Yes; the two instances you mentioned are bugs and should be fixed. Jacob -- 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?hl=en.
