[Zope] Problem with Batch search

egf05 at doc.ic.ac.uk egf05 at doc.ic.ac.uk
Fri Aug 18 04:22:59 EDT 2006


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:

batch python:modules['ZTUtils'].Batch(results, size=20, start=start);

and then displays only 20 object rids per page. If it finds for instance 31
object, It gives a link to the "Next 11 results". However, this is where it is
broken. Clicking on the link leads to have ALL objects in the catalog being
displayed. It now offers "Previous 20 results / Next 20 results" and you can
display all objects.

Is it a problem in Batch? or a bug in the SearchReport Page Template?

Thank you,
Eric

PS: This are the generated SearchReport Template:
<html><body>
<html>
  <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">

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

  <table border>
        <tr>
          <th>Data record id </th>
        </tr>
       
  <tal:x repeat="result batch" >
  
         <tr>
          <td><span tal:replace="result/data_record_id_">data_record_id_ goes
here</span></td>
        </tr>

  </tal:x>

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

  </body>
</html>

</body></html>


More information about the Zope mailing list