On Mon, 2007-03-26 at 11:17 +0200, Arvin Schnell wrote:
> On Sat, Mar 24, 2007 at 06:42:08AM -0000, SmileyChris wrote:
> > 
> > For a while I've been thinking that it would be nice to have a tag so
> > you could re-use an expression in a template.
> > I did one up and put it on http://www.djangosnippets.org/snippets/132/
> > 
> > Is this useful enough for core?
> 
> I would like to see a tag like that.  The fact that snippet #9
> and #124 deal with the same problem shows the people need/want
> it.

Snippet #9 is quite different. It's providing arbitrary expression
computation, which is out of scope for the core templating language, but
is a useful third-party add-on for some people. Limodou been maintaining
that for quite a while now.

Chris's snippet #132 looks a bit nicer than #124. The "ifvalue"
construction in #124 looks like it's trying to do two or three things at
once. If I wanted that, I'd use Perl.

I'm personally a bit indifferent (which is not the same as "against"
before anybody gets riled up) to the arguments about "saving typing",
since all editors have decent auto-complete these days and it's just a
slightly longer name if you don't have aliasing. However, on a related
topic, it's easy when writing things like object.person.count to create
repetitive queries (there's no reuse of that queryset if you type the
same thing later). So I was thinking in idle moments today about how
possible it would be to add transparent caching to templates. It doesn't
seem to be impossible, although I need to sit down with a pen and paper
and scratch my head a bit more to work out the details (for example, you
need to have a way to mark some tags/filters as volatile so that
something like the "random" filter doesn't behave identically to the
hypothetical "always the same" filter).

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 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to