[Zope] inheritance in python product

Florent Guillaume fg@nuxeo.com
Fri, 7 Jun 2002 15:59:42 +0000 (UTC)


Sylvain Thénault  <thenault@nerim.net> wrote:
> I've a problem to have a class which inherits from zope base classes
> (Role.RoleManager, Acquisition.Implicit, ObjectManager.ObjectManager and
> Persistent) and classes from another package.
> As soon as a class inherits from one of the zope base class, I get an
> exception when I try to instantiate an object of this class. This
> exception is raised when I try to call the ancestor constructor:
> 
>  ZNodeImpl.__init__(self, id, title)
>  TypeError: unbound method __init__() must be called with instance as
>  first argument
> 
> this sounds like my class doesn't inherit from ZNodeImpl but it does !!
> If I remove the zope base class, everything works correctly...
> 
> it seems to have some python black magic here. Anybody can explain this
> to me or give some pointers ?

That's weird because I've used it a number of times.
For instance:

    class PortalContentFolder(PortalFolder, PortalContent, DefaultDublinCoreImpl):
        #...
        def __init__(self, id, title='', **kw):
        DefaultDublinCoreImpl.__init__(self)
        self.id = id
        self.title = title

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com