[reportlab-users] pycanvas string problems
Robin Becker
reportlab-users@reportlab.com
Sun, 20 Oct 2002 11:42:32 +0100
Yes I tried some expriments and even in 2.2 the coercion doesn't seem to happen as expected.
This fails and I can't understand exactly how it differs from what you're
doing in pycanvas.
import sys, string
class Bonkers:
def __init__(self):
class F:
fontName = 'Times-Roman'
self._object = F()
class Action:
def __init__(self, parent, action):
self._parent = parent
self._action = action
def __str__(self):
return str(getattr(self._parent._object, self._action))
def __coerce__(self, other):
return coerce(getattr(self._parent._object, self._action), other)
def __getattr__(self,name):
return self.Action(self,name)
print sys.version
iam=Bonkers()
print iam.fontName,
print string.lower(iam.fontName)
--
Robin Becker