----- Original Message ----- From: "Programmer" <[EMAIL PROTECTED]>
To: <zope@zope.org>
Sent: Wednesday, May 30, 2007 4:44 PM
Subject: [Zope] a batch of inSaNitY!


I am about to go stark, raving, frothing mad with the DTML-IN batching.
Is there a known (or unknown) bug with this?

I have searched and read everything I can find about this and no luck.
The problem is with carrying the query terms over from one batch page to
the next. Right now I am using the script found here:

Except I changed,

 batch="_.range(100, 180)"



The mySQLMethod1 takes two params which the search form supplies to
REQUEST. This works great. The pagination works beautifully. However,
when I use the very same result script with myZSQLMethod2 (same DB
table), which takes 5 params (all optional) the pagination breaks and
no-longer passes the query terms.
I have checked and rechecked both scripts and both forms. The
ZSQLMethods both test good. I am out of ideas. For the life of me I
cannot figure out why I'm losing my query terms in one and not the other
when the two are almost identical.
Care to enlighten me with your collective wisdom?

In similar situations I have done the following:

1) call a python script/external method which: (i) does the db search; (ii) formats the results as required for display; (iii) returns a tuple that contains: list of search results, url parameters for 'previous' link; url parameters for 'next' link; url parameters for 'first link'; url parameters for 'last' link

2) use a dtml method to call the script/ext.method like

<dtml-let rStat="mySearchRoutine(parm1, parm1, ...)">

 <dtml-in "rStat[0]">
     display code here eg.  <dtml-var sequence-item><br>
     or could be an html/css table, etc.

    <dtml-if sequence-end>
        <a href="...?<dtml-var "rStat[1]">">previous</a>
        <a href="...?<dtml-var "rStat[2]">">next</a>
        <a href="...?<dtml-var "rStat[3]">">first</a>
        <a href="...?<dtml-var "rStat[4]">">last</a>


This greatly simplifies the dtml and facilitates debugging and future modifications.



Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to