tables.py: be evn more robust about width/drawWidth etc
authorrgbecker
Wed, 23 Mar 2005 13:35:58 +0000
changeset 2471 76c745e075b2
parent 2470 74a7b9da41e4
child 2472 6795e616cdbe
tables.py: be evn more robust about width/drawWidth etc
reportlab/platypus/tables.py
--- a/reportlab/platypus/tables.py	Wed Mar 23 11:35:10 2005 +0000
+++ b/reportlab/platypus/tables.py	Wed Mar 23 13:35:58 2005 +0000
@@ -367,14 +367,15 @@
                 w = max(w,ew)
             return w
         elif isinstance(v,Flowable) and v._fixedWidth:
-            if hasattr(v, 'width'): return v.width
-            if hasattr(v, 'drawWidth'): return v.drawWidth
+            if hasattr(v, 'width') and type(v.width) in (IntType,FloatType): return v.width
+            if hasattr(v, 'drawWidth') and type(v.drawWidth) in (IntType,FloatType): return v.drawWidth
         # Even if something is fixedWidth, the attribute to check is not
         # necessarily consistent (cf. Image.drawWidth).  Therefore, we'll
         # be extra-careful and fall through to this code if necessary.
         if hasattr(v, 'minWidth'):
             try:
-                return v.minWidth() # should be all flowables
+                w = v.minWidth() # should be all flowables
+                if type(w) in (FloatType,IntType): return w
             except AttributeError:
                 pass
         if t is not StringType: v = v is not None and str(v) or ''