[Zope-CMF] getattr misbehaving
seb bacon
seb@jamkit.com
Sat, 21 Apr 2001 21:02:34 +0100
I've got an extremely wierd problem here, tho it may not be CMF-specific.
I'm overriding __call__ to return a method dynamically in some
PortalContent, like this:
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
_method = self.callMethod
print _method
# prints 'edit_view'
return getattr(self,_method)(self, REQUEST)
that doesn't work, even though _method is returning the correct string.
instead it returns the 'view' method. However, when I do this:
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
_method = 'edit_view'
print _method
# prints 'edit_view'
return getattr(self,_method)(self, REQUEST)
it works :S
What's going on? (I'm sure there must be a better way to do this,
anyway...:)
seb