[Zope] ASC / DESC in queries`?

Jim Washington jwashin@vt.edu
Tue, 26 Feb 2002 13:25:05 -0500


Thomas B. Passin wrote:
> [Jim Washington]
> 
> 
>>I would set it to a zero-length string. Zope handles the following OK on
>>my machine.
>>
>><a href="<dtml-var URL0>?sort_order_asc=1">ascending</a>
>><a href="<dtml-var URL0>?sort_order_asc=">descending</a>
>>
> 
> Better to have it be   ...sort_order_asc=0 so that you can be sure that the
> property exists.  You can still test it easily using dtml-if.  Otherwise the
> test may fail because the property does not exist.

I thought that too, then tested it.  ...sort_order_asc=0 returns a 
string, '0', which tests true.  The dtml we were working with just 
tested existence or truth, <dtml-if sort_order_asc>, so sending an empty 
string in this case works better, unless one really wants to go through 
the trouble of checking for existence, then doing an _.int on it or 
running it through <dtml-try>.

Unless, of course, it is invalid HTML, which I haven't checked. :)

-- Jim Washington