[Zope] Problem with Batch search

egf05 at doc.ic.ac.uk egf05 at doc.ic.ac.uk
Fri Aug 18 04:32:57 EDT 2006


Selon egf05 at doc.ic.ac.uk:

> Hi,
> 
> I think I found a bug in the automatically generated Z Search Forms, as
> described in the manual (16-4: Creating a search form for a ZCatalog). This
> creates two files: SearchForm and SearchReport. SearchReport uses this
> method:

I answer to myself because I think I found the rpoblem. The problem is that when
going to the next page, the query is not copied into the URL.
I corrected this way:

<body tal:define="results  here/catalog;
                    start request/start|python:0;
                    batch python:modules['ZTUtils'].Batch(results,
                                                          size=20,
                                                          start=start);
                    previous python:batch.previous;
                    next python:batch.next;
                    textidx request/textidx">


and:


<p>
        <a tal:condition="previous"
           tal:attributes="href
string:${request/URL0}?start:int=${previous/first}&textidx=${textidx}"
           href="previous_url">previous <span
tal:replace="previous/length">size</span> results</a>
        <a tal:condition="next"
           tal:attributes="href
string:${request/URL0}?start:int=${next/first}&textidx=${textidx}"
           href="next_url">next <span tal:replace="next/length">20</span>
results</a>
       </p>


Now it works.

Eric


More information about the Zope mailing list