src/reportlab/platypus/paraparser.py
branchpy33
changeset 3731 b233dd0577ff
parent 3723 99aa837b6703
child 3787 8f9be6d6f75c
--- a/src/reportlab/platypus/paraparser.py	Thu Mar 07 17:54:44 2013 +0000
+++ b/src/reportlab/platypus/paraparser.py	Wed May 01 16:43:09 2013 +0100
@@ -5,7 +5,6 @@
 __doc__='''The parser used to process markup within paragraphs'''
 import string
 import re
-from types import TupleType, UnicodeType, StringType
 import sys
 import os
 import copy
@@ -106,7 +105,7 @@
     raise ValueError('Invalid autoLeading=%r' % x )
 
 def _align(s):
-    s = string.lower(s)
+    s = s.lower()
     if s=='left': return TA_LEFT
     elif s=='right': return TA_RIGHT
     elif s=='justify': return TA_JUSTIFY
@@ -207,7 +206,7 @@
     for k in K:
         n = m[k][0]
         if n not in m: m[n] = m[k]
-        n = string.lower(n)
+        n = n.lower()
         if n not in m: m[n] = m[k]
 
 _addAttributeNames(_paraAttrMap)
@@ -219,7 +218,7 @@
 
 def _applyAttributes(obj, attr):
     for k, v in attr.items():
-        if type(v) is TupleType and v[0]=='relative':
+        if isisntance(v,(list,tuple)) and v[0]=='relative':
             #AR 20/5/2000 - remove 1.5.2-ism
             #v = v[1]+getattr(obj,k,0)
             if hasattr(obj, k):
@@ -980,7 +979,7 @@
         A = {}
         for k, v in attr.items():
             if not self.caseSensitive:
-                k = string.lower(k)
+                k = k.lower()
             if k in list(attrMap.keys()):
                 j = attrMap[k]
                 func = j[1]
@@ -1070,7 +1069,7 @@
         # and revert at end.  Yuk.  Preliminary step prior to
         # removal of parser altogether.
         enc = self._enc = 'utf8' #our legacy default
-        self._UNI = type(text) is UnicodeType
+        self._UNI = isinstance(text,str)
         if self._UNI:
             text = text.encode(enc)
 
@@ -1118,7 +1117,7 @@
         if C:
             M = self._tt_handlers
             for c in C:
-                M[type(c) is TupleType](c)
+                M[isinstance(c,(list,tuple))](c)
         end()
 
     def tt_parse(self,tt,style):