[Zope] Sort variable within the 'IN' tag

Amos Latteier amos@aracnet.com
Mon, 19 Apr 1999 09:26:58 -0700


At 04:02 PM 4/19/99 GMT, Wombat Harness wrote:
>Is there any way of using a variable passed through on the query 
>string to specify what the in command is sorted on, i just get an 
>error if i try to use any type of variable...

I think that I ran up against this limitation a while ago too. Basically
some tag arguments accept literals, some that accept names of variables,
and others accept expressions. The general rhythm, which seems a bit
annoying, is to have two attributes if you want both kinds of access. So
you could modify the 'in' tag to have a 'sort_expr' attribute as well as a
'sort' attribute. 

If you want to take a crack at it, the file to modify is
lib/python/DocumentTemplate/DT_In.py

(Hey while you're at it how about a 'reverse' attribute which reverses the
list when set to true ;-)

It might be nice to find some way around this need for double attributes.
Perhaps all tag attributes should accept expressions. Or maybe there could
be a special way to spell an expression when a literal is expected... Maybe
the still undocumented DTML tag framework needs a tune up. I'm not sure
what the answer is, but it seems like things could be cleaner and more
flexible.

-Amos