[Zope-dev] Multiple inheritance woes

Phillip J. Eby pje@telecommunity.com
Thu, 09 Sep 1999 07:06:59 -0500


At 01:40 PM 9/9/99 +0200, Martijn Pieters wrote:
>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)

The last line may be your problem.  Try:

          CatalogAware.index_object.im_func(self)

This construct is often required when calling base class methods from an
ExtensionClass deriviative.  You will sometimes get an error such as you
describe, when performing such a call, because the type Python thinks
something is may be different if the thing is in an acquisition wrapper or
is an ExtensionClass when the base class is NOT based on an ExtensionClass.
 Pretty much I make it a habit in all my Python to use the .im_func()
construct for calling base class methods, because then I never have to
worry about what kind of objects I'm using.