Hi, I got a strange behaviour when subclassing a non Zope class (called MyBase) that has - and needs - an __init__(...) by another class that provides Zope features (called MyZSub). from OFS.SimpleItem import SimpleItem from mybase import MyBase ... def manage_addMyZSub(self, id, title='', REQUEST=None): o = MyZSub(id, title) self._setObject(id, o) ... class MyZSub(SimpleItem, MyBase): ... def __init__(self, id, title=''): self.id = id self.title = title # isinstance(self, MyZSub) -> 1 :) # isinstance(self, MyBase) -> 0 :( # (very strange) # THIS RAISES THE EXCEPTION BELOW MyBase.__init__(self) ... Creating a new MyZSub object raises this !!! Error Type: TypeError Error Value: unbound method __init__() must be called with instance as first argument. I can't get what happens. Is "self" something else than the newly created object when in such a class !!!??? When removing this line, it works (except of course there's no construction of the base class 8(( This (MyBase.__init__(self)) works perfectly when subclassing MyBase by any non Zope test class - including with multiple inheritance !!! I can't understand why "self" is not instance of MyBase !!!
class a: pass class b: pass class c(a, b): pass x=c() isinstance(x, a) 1 isinstance(x, b) 1
I made a quick hack tour in the Zope products installed in my serer and I didn't notice any product trying to call the constructor of its base class from its own constructor. Has someone a hint. Please, I'm falling into a nervous breakdown... Thanks in advance. --Gilles