[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zope-db
Subject:    RE: [Zope-DB] database connection
From:       "Rivera Merla Jose" <JRIVERA () oxxo ! femsa ! com ! mx>
Date:       2006-01-10 23:33:32
Message-ID: 2CED9D9403330B45B0C199B928A2AC52EFD8ED () fcexmty02 ! comercio ! fne
[Download RAW message or body]

>On 2006-01-10 at 12:50:41 [+0100], Martin Krallinger
<martink@cnb.uam.es> 
>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
_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic