[Zope] DTML batch processing variables

Martijn Pieters mj@antraciet.nl
Fri, 25 Jun 1999 15:20:03 +0200


At 13:55 25/06/99 , Oleg Broytmann wrote:
>Hi!
>
>On Fri, 25 Jun 1999, Martijn Pieters wrote:
> > >next-sequence-size is alway "1", and previous-sequence-size is
> > >"-90","-70","-50","-30","-10" everything else works as described.
> >
> > What version of Zope and Python are you using? There is a known bug with
> > all versions of Zope up to Zope 2.0.0a2 (fixed in Zope 2.0.0a3) that
> > becomes effective when using python 1.5.2.
>
>    I wonder how is it possible to develop a program that does different
>calculations (very simle math, I think) with 1.5.1 and 1.5.2?
>
>    Any cahnce we'd see a patch? I'd like to incorporate it into 1.10.3...

It has nothing to do with simple math, but everything with the 
interpretation of None compaired to 0's. Something that was implemented 
wrongy in python 1.5.1, and fixed in 1.5.2. This change brought out a bug 
in the code, which hitherto had managed to miraculously work anyway.

1.10.3 is meant to run with python 1.5.1, not 1.5.2, and has only been 
tested with 1.5.1. There are other problems concerning running Zope 1.10.3 
with version 1.5.1 than this one, like Netscape Publishing, FTP uploads and 
WebDAV being broken.

If you insist, here is a context diff from the CVS you could apply, it 
probably has slightly differing line numbers, but you should be able to 
apply it to DT_In.py anyway, as patch will correct for this. It basically 
replaces all occurrences of None within calls to the method 'opt' with 0:

***************
*** 531,537 ****
           try:
               if previous:
                   if first > 0:
!                     pstart,pend,psize=opt(None,first+overlap,
                                             sz,orphan,sequence)
                       kw['previous-sequence']=1
                       kw['previous-sequence-start-index']=pstart-1
--- 531,537 ----
           try:
               if previous:
                   if first > 0:
!                     pstart,pend,psize=opt(0,first+overlap,
                                             sz,orphan,sequence)
                       kw['previous-sequence']=1
                       kw['previous-sequence-start-index']=pstart-1
***************
*** 547,553 ****
                       # there are more items, without actually
                       # computing a length:
                       sequence[end]
!                     pstart,pend,psize=opt(end+1-overlap,None,
                                             sz,orphan,sequence)
                       kw['next-sequence']=1
                       kw['next-sequence-start-index']=pstart-1
--- 547,553 ----
                       # there are more items, without actually
                       # computing a length:
                       sequence[end]
!                     pstart,pend,psize=opt(end+1-overlap,0,
                                             sz,orphan,sequence)
                       kw['next-sequence']=1
                       kw['next-sequence-start-index']=pstart-1
***************
*** 563,569 ****
                   validate=md.validate
                   for index in range(first,end):
                       if index==first and index > 0:
!                         pstart,pend,psize=opt(None,index+overlap,
                                                 sz,orphan,sequence)
                           kw['previous-sequence']=1
                           kw['previous-sequence-start-index']=pstart-1
--- 563,569 ----
                   validate=md.validate
                   for index in range(first,end):
                       if index==first and index > 0:
!                         pstart,pend,psize=opt(0,index+overlap,
                                                 sz,orphan,sequence)
                           kw['previous-sequence']=1
                           kw['previous-sequence-start-index']=pstart-1
***************
*** 577,583 ****
                                   # test whether there are more items,
                                   # without actually computing a length:
                                   sequence[end]
!                                 pstart,pend,psize=opt(end+1-overlap,None,
                                                         sz,orphan,sequence)
                                   kw['previous-sequence']=0
                                   kw['next-sequence']=1
--- 577,583 ----
                                   # test whether there are more items,
                                   # without actually computing a length:
                                   sequence[end]
!                                 pstart,pend,psize=opt(end+1-overlap,0,
                                                         sz,orphan,sequence)
                                   kw['previous-sequence']=0
                                   kw['next-sequence']=1

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------