fixes to crashing PTO trailer when empty, and numbering
authorandy
Sun, 01 Oct 2006 22:53:20 +0000
changeset 2694 dd0ea6474ea0
parent 2693 3c61a57aecd1
child 2695 feb999d5dbd1
fixes to crashing PTO trailer when empty, and numbering
reportlab/platypus/flowables.py
reportlab/platypus/paraparser.py
--- a/reportlab/platypus/flowables.py	Fri Sep 29 19:37:07 2006 +0000
+++ b/reportlab/platypus/flowables.py	Sun Oct 01 22:53:20 2006 +0000
@@ -744,7 +744,10 @@
                 T = I.trailer
                 Hdr = I.header
                 tW, tH = _listWrapOn(T, availWidth, self.canv)
-                tSB = T[0].getSpaceBefore()
+                if len(T):  #trailer may have no content
+                    tSB = T[0].getSpaceBefore()
+                else:
+                    tSB = 0
                 I2W[I] = T,tW,tH,tSB
             else:
                 T,tW,tH,tSB = I2W[I]
--- a/reportlab/platypus/paraparser.py	Fri Sep 29 19:37:07 2006 +0000
+++ b/reportlab/platypus/paraparser.py	Sun Oct 01 22:53:20 2006 +0000
@@ -612,7 +612,18 @@
             id = attr['id']
         else:
             id = None
-        output = self._seq.nextf(id)
+        increment = attr.get('inc', None)
+        if not increment:
+            output = self._seq.nextf(id)
+        else:
+            #accepts "no" for do not increment, or an integer.
+            #thus, 0 and 1 increment by the right amounts.
+            if increment.lower() == 'no':
+                output = self._seq.thisf(id)
+            else:
+                incr = int(increment)
+                output = self._seq.thisf(id)
+                self._seq.reset(id, self._seq._this() + incr)
         self.handle_data(output)
 
     def end_seq(self):