more python3 compat fixes py33
authorrobin
Thu, 01 Aug 2013 17:17:38 +0100
branchpy33
changeset 3763 d079e73fb7b0
parent 3762 4817e577522d
child 3764 010823faf496
more python3 compat fixes
src/reportlab/graphics/renderPM.py
src/reportlab/lib/attrmap.py
src/reportlab/pdfbase/ttfonts.py
--- a/src/reportlab/graphics/renderPM.py	Thu Aug 01 16:47:07 2013 +0100
+++ b/src/reportlab/graphics/renderPM.py	Thu Aug 01 17:17:38 2013 +0100
@@ -25,7 +25,7 @@
 import string, os, sys
 
 try:
-    import _renderPM
+    from reportlab.graphics import _renderPM
 except ImportError as errMsg:
     raise ImportError("No module named _renderPM\n" + \
         (str(errMsg)!='No module named _renderPM' and "it may be the wrong version or badly installed!" or
--- a/src/reportlab/lib/attrmap.py	Thu Aug 01 16:47:07 2013 +0100
+++ b/src/reportlab/lib/attrmap.py	Thu Aug 01 17:17:38 2013 +0100
@@ -70,22 +70,18 @@
         data = {}
         if BASE:
             if isinstance(BASE,AttrMap):
-                data = BASE.data                        #they used BASECLASS._attrMap
+                data = BASE
             else:
                 if not isSeq(BASE): BASE = (BASE,)
                 for B in BASE:
                     if hasattr(B,'_attrMap'):
-                        data.update(getattr(B._attrMap,'data',{}))
+                        data.update(B._attrMap)
                     else:
-                        raise ValueError('BASE=%s has wrong kind of value' % str(B))
+                        raise ValueError('BASE=%s has wrong kind of value' % repr(B))
 
         dict.__init__(self,data)
         self.remove(UNWANTED)
-        self.data.update(kw)
-
-    def update(self,kw):
-        if isinstance(kw,AttrMap): kw = kw.data
-        self.data.update(kw)
+        self.update(kw)
 
     def remove(self,unwanted):
         for k in unwanted:
--- a/src/reportlab/pdfbase/ttfonts.py	Thu Aug 01 16:47:07 2013 +0100
+++ b/src/reportlab/pdfbase/ttfonts.py	Thu Aug 01 17:17:38 2013 +0100
@@ -62,8 +62,9 @@
     pass
 
 
-def SUBSETN(n,table=string.maketrans('0123456789','ABCDEFGHIJ')):
-    return ('%6.6d'%n).translate(table)
+def SUBSETN(n):
+    z = ord('0')
+    return ''.join(['ABCDEFGHIJ'[c-z] for c in bytes('%6.6d'%n,'ASCII')])
 #
 # Helpers
 #