RE: database connection

"Rivera Merla Jose" <[email protected]>
Newsgroups gmane.comp.web.zope.database
Message-ID <[email protected]>
>On 2006-01-10 at 12:50:41 [+0100], Martin Krallinger
<[email protected]> 
>wrote:
>> Hi all,
>> 
>> 
>> I am using zope to connect to my postgres database using psycopg.
>> Everything works fine, I can connect to the db and do queries, the
first
>> 20 results are displayed correctly, but when I want to display the
>> '(Next 20 results)' I get the following error:
>
>This is a standard error in ZSQL's test pages and is due to the fact
that >the 
>query parameters are not included in the link for the next 20 results.>
>
>Charlie
>

Hi

The problem can be found where the page template defines the link to the
next 20 pages, look:

  <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>


Do you see the code '?start:int', you should add there the parameters
needed for your ZSQL or take the easy path of change the batch size to a
big number like 65000.

You can do these using this lines:
                    batch python:modules['ZTUtils'].Batch(results, 
                                                          size=65000, 
                                                          start=start);
instead of:

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

I hope this can be of any help...

Bye
Jose Rivera Merla
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.