[Zope] Re: Complex <dtml-in> query sorting
Maik Jablonski
maik.jablonski@uni-bielefeld.de
Wed, 12 Mar 2003 20:02:26 +0100
Thierry FLORAC wrote:
> My code (in a DTML method) is like :
>
> <dtml-in "[getObject(record['oid']) for record in sql_method(params)]"
> sort_expr="getSortValue()">
>
> The <dtml-in> loop works well and retrieves my object, but the "sort_expr"
> attribute doesn't work and so results are not sorted ; it seems that
> "getSortValue()" is not called on the good object...
As far as I know sort_expr in dtml-in means: evaluate the expression and
use the result as sort-key. So if you have a variable skey in your
namespace and use <dtml-in ... sort_expr="skey"> you get different
sortings depending on the value of skey (title, id, ...).
You need an already sorted sequence. See ZopeHelp->ApiReference->sequence.
-mj