[Zope-Checkins] CVS: Zope2 - DT_In.py:1.43.4.3

Brian Lloyd brian@digiciool.com
Thu, 8 Mar 2001 13:35:10 -0500 (EST)


Update of /cvs-repository/Zope2/lib/python/DocumentTemplate
In directory korak:/home/brian/temp/zope-23-branch/lib/python/DocumentTemplate

Modified Files:
      Tag: zope-2_3-branch
	DT_In.py 
Log Message:
Added Dieter Maurer's patch to fix batching info (bug #1317)



--- Updated File DT_In.py in package Zope2 --
--- DT_In.py	2001/02/13 12:03:35	1.43.4.2
+++ DT_In.py	2001/03/08 18:35:10	1.43.4.3
@@ -577,29 +577,31 @@
                 append=result.append
                 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
-                        kw['previous-sequence-end-index']=pend-1
-                        kw['previous-sequence-size']=pend+1-pstart
-                    else:
-                        kw['previous-sequence']=0
-                        if index==last:
-                            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['previous-sequence']=0
-                                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: pass
+                    # preset
+                    kw['previous-sequence']= 0
+                    kw['next-sequence']= 0 # now more often defined then previously
+                    #
+                    if index==first or index==last:
+                        # provide batching information
+                        if first > 0:
+                            pstart,pend,psize=opt(0,first+overlap,
+                                                  sz,orphan,sequence)
+                            if index==first: kw['previous-sequence']=1
+                            kw['previous-sequence-start-index']=pstart-1
+                            kw['previous-sequence-end-index']=pend-1
+                            kw['previous-sequence-size']=pend+1-pstart
+                        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)
+                            if index==last: 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: pass
         
                     if index==last: kw['sequence-end']=1