[Zope] Inheritance (?) problem

Dieter Maurer dieter@handshake.de
Fri, 3 May 2002 19:29:16 +0200


Luca Manini writes:
 > I have a pure-python (no Zope classes around) 'form' class like this:
 > 
 > class form:
 > 
 >     def __init__(self, id):
 >         self.id = id
 > 
 >     def actionTarget(self, REQUEST={}):
 >         "Main entry point."
 >         return 'foo'
 > 
 > >From this class I derive a subclass 
 > 
 > class zopeForm (SimpleItem.SimpleItem, form):
 > 
 >     def actionTarget(self, REQUEST={}):
 >         "Main entry point."
 >         # ... other thing done here...
 > 	form.actionTarget (self, REQUEST)
 > 
 > The zopeForm class is part of a product so I have instances of
 > zopeForm (say 'zf') in a folder (say 'foo'). Now I would like to visit
 > the URL
 > 
 >     ...../foo/zf/actionTarget
 > 	
 > but I get the following error:
 > 
 > 	Error Type: TypeError
 >         Error Value: unbound method must be called with 
 > 		     class instance 1st argument
 > 
 > but 'self' in the call to form.actionTarget should be a zopeForm
 > instance! 
This is an ExtensionClass/Python incompatibility, documented with
ExtensionClass. You need "inheritedAttribute" to work around the
problem, documented too.


Dieter