--- a/src/reportlab/platypus/paraparser.py Thu Jul 02 08:12:53 2009 +0000
+++ b/src/reportlab/platypus/paraparser.py Thu Jul 02 13:53:21 2009 +0000
@@ -9,6 +9,11 @@
import sys
import os
import copy
+import base64
+try:
+ import cPickle as pickle
+except:
+ import pickle
import unicodedata
import reportlab.lib.sequencer
from reportlab.lib.abag import ABag
@@ -176,6 +181,8 @@
_indexAttrMap = {
'name': ('name',None),
'item': ('item',None),
+ 'offset': ('offset',None),
+ 'format': ('format',None),
}
def _addAttributeNames(m):
@@ -896,13 +903,23 @@
attr=self.getAttributes(attr,_indexAttrMap)
defn = ABag()
if attr.has_key('item'):
- defn.label = attr['item']
+ label = attr['item']
else:
self._syntax_error('<index> needs at least an item attribute')
if attr.has_key('name'):
name = attr['name']
else:
name = DEFAULT_INDEX_NAME
+ format = attr.get('format',None)
+ if format is not None and format not in ('123','I','i','ABC','abc'):
+ raise ValueError('index tag format is %r not valid 123 I i ABC or abc' % offset)
+ offset = attr.get('offset',None)
+ if offset is not None:
+ try:
+ offset = int(offset)
+ except:
+ raise ValueError('index tag offset is %r not an int' % offset)
+ defn.label = base64.encodestring(cPickle.dumps((label,format,offset))).strip
defn.name = name
defn.kind='index'
self._push(cbDefn=defn)