[Zope-dev] Bug in DT_In.py, still using collector? Here's a patch

Brad Clements bkc@murkworks.com
Tue, 8 Aug 2000 12:05:13 -0400


In Zope 2.2.0 

If you have a bug in your DTML in a <dtml-in xx next> block, you don't 
see the bug. DT_In assumes that you just don't have more records to 
see.

DT_In.py, around line 545

This code:

            elif next:
                try:
                    # The following line is a sneaky way to 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['next-sequence']=1
                    kw['next-sequence-start-index']=pstart-1
                    kw['next-sequence-end-index']=pend-1
                    kw['next-sequence-size']=pend+1-pstart
                    result=render(section,md)
                except:
                    if self.elses: result=render(self.elses, md)
                    else: result=''

SHOULD BE:

            elif next:
                try:
                    # The following line is a sneaky way to 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['next-sequence']=1
                    kw['next-sequence-start-index']=pstart-1
                    kw['next-sequence-end-index']=pend-1
                    kw['next-sequence-size']=pend+1-pstart
                except:
                    if self.elses: result=render(self.elses, md)
                    else: result=''
                else:
                    result=render(section,md)


Brad Clements,                bkc@murkworks.com   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com               AOL-IM: BKClements