[ZPT] Re: batching and sorting in one go

Michal Kurowski michal@genesilico.pl
Thu, 27 Jun 2002 21:25:24 +0200


Casey Duncan [casey@zope.com] wrote:
> The problem is that the batch object has no sort method. So it throws
> that attribute error when you call: out = batch.sort(...)
> 
> You need to sort the results before you batch it. Since you are using a
> ZSQL method, it probably makes sense to add a variable "ORDER BY" clause
> to it, passing the name of the column to sort on as an argument to the
> ZSQL method.
> 
> Then the database will do the sorting for you which is usually
> desireable.
> 
> hth,
> 
> -Casey


OK, your right but I'm still having problems...

How would I test presence of "sorted" and non-sorted sql results in a
template ? 

I've got that:

<a tal:attributes="href python: here.pass_sorted(variable='status', mode='asc')">

where pass_sorted is anothr ZSQL method that takes additional
parameters.

Is there a simple way to re-render my template after testing "results" ?

--
Michal Kurowski
<michal@genesilico.pl>