[Zope-dev] Multiple inheritance woes

Rik Hoekstra hoekstra@fsw.leidenuniv.nl
Thu, 09 Sep 1999 14:33:42 +0200


> Hmm.. I know this is a python question, but DejaNews nor the Python website 
> give me the answers I am looking for:
> 
> I define a baseclass derived from CatalogAware and DTMLMethod:
> 
> class Base(CatalogAware, DTMLMethod):
>      def index_object(self):
>          # check a few things I want to know about
>          # before indexing, maybe even not allowing
>          # the indexing
>          CatalogAware.index_object(self)
> 
> 

A shot in the dark: Shouldn't this be 
CatalogAware().index_object(self)? At least this explicitly 
instanciates CatalogAware and stops raising TypeErrors. But I'm not 
sure this completely solves your problem

Rik

> Then I define a bunch of classes based on this base class:
> 
> class A(Base):
>      pass
> 
> class B(Base):
>      pass
> 
> etc.
> 
> Now, if I do the following:
> 
> a=A()
> a.index_object()
> 
> I get a TypeError:
>    unbound method must be called with class instance 1st argument
> 
> Now, I have seen all sorts of messages relating this error, but none of 
> them seem to relate to my problem...
> 
> self in Vase.index_object _is_ a class instance, a step-by-step debug 
> proves this. The python interpreter just won't accept it =(.
> 
> --
> Martijn Pieters, Web Developer
> | Antraciet http://www.antraciet.nl
> | Tel: +31-35-7502100 Fax: +31-35-7502111
> | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
> | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
> ------------------------------------------
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://www.zope.org/mailman/listinfo/zope-dev
> 
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
> 
> For non-developer, user-level issues, 
> zope@zope.org, http://www.zope.org/mailman/listinfo/zope )