doctemplate.py: use annotateException & allow page templates to be any string type py33
authorrobin
Wed, 05 Feb 2014 14:19:09 +0000
branchpy33
changeset 4018 c69c31436936
parent 4017 8248cb6111c2
child 4019 dcbcae8fbb8f
doctemplate.py: use annotateException & allow page templates to be any string type
src/reportlab/platypus/doctemplate.py
--- a/src/reportlab/platypus/doctemplate.py	Tue Feb 04 13:18:18 2014 +0000
+++ b/src/reportlab/platypus/doctemplate.py	Wed Feb 05 14:19:09 2014 +0000
@@ -35,7 +35,7 @@
 from reportlab.rl_config import defaultPageSize, verbose
 import reportlab.lib.sequencer
 from reportlab.pdfgen import canvas
-from reportlab.lib.utils import isSeq, encode_label, decode_label
+from reportlab.lib.utils import isSeq, encode_label, decode_label, annotateException, strTypes
 try:
     set
 except NameError:
@@ -142,8 +142,7 @@
             else:
                 raise
         except:
-            t, v, tb = sys.exc_info()
-            raise t("%s\n   handle_%s args=%s"%(v,action,args)).with_traceback(tb)
+            annotateException("\nhandle_%s args=%s"%(action,ascii(args)))
 
     def __call__(self):
         return self
@@ -634,7 +633,7 @@
 
     def handle_nextPageTemplate(self,pt):
         '''On endPage change to the page template with name or index pt'''
-        if isinstance(pt,str):
+        if isinstance(pt,strTypes):
             if hasattr(self, '_nextPageTemplateCycle'): del self._nextPageTemplateCycle
             for t in self.pageTemplates:
                 if t.id == pt: