[Zope] Sort variable within the 'IN' tag

Pavlos Christoforou pavlos@gaaros.msrc.sunysb.edu
Mon, 19 Apr 1999 13:00:45 -0400 (EDT)


Thanks Amos for reading the posted questions more carefully than I do.

Another limitation/feature I encountered when using the sort option is
that if any of the iterated objects does not contain the attribute
specified with the sort option then an error is raised. It would be nice
if there was an option to skip such objects. Does anyone know of way to do
this in simple DTML? Until now I have been using external methods to
filter out inappropriate entries.

Pavlos 

On Mon, 19 Apr 1999, Amos Latteier wrote:

> 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
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (For developer-specific issues, use the companion list,
> zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
>