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>
Selon egf05@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
participants (1)
-
egf05@doc.ic.ac.uk