On Nov 29, 6:40 am, Luke Plant <l.plant...@cantab.net> wrote: > Hi all, > > I started work replacing Django's if with the "smart-if" template tag > by Chris Beaven (http://www.djangosnippets.org/snippets/1350/)
Neat! I'm assuming you'll be posting this to your bitbucket soon? :) > 1) Handling non-existent variables > 2) TEMPLATE_STRING_IF_INVALID breaks everything Yep, this is a bit of a problem which I've been thinking about recently (encountered it for a project). My (non-implemented) solution to both of these is to use a NotFound object. I just coded one up: http://gist.github.com/244861 This could actually be a much better return value than a plain TEMPLATE_STRING_IF_INVALID string in general. > 3) Behaviour of 'x and b or y' Like I commented in the snippet, I don't think it's worth obfuscating code to limit this behaviour. > 4) Behaviour of 'not' Bleh, whatever. If we need it for backwards compatibility, it's not hard to implement. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.