[Zope] Inheritance glitches?

Martijn Pieters mj@antraciet.nl
Fri, 22 Oct 1999 12:48:00 +0200


At 08:59 22/10/99 , Benno Rice wrote:
>Hi,
>
>I'm trying to write an external ZClass base class which inherits from
>CatalogAware and another external ZClass base I've written.
>
>I'm trying to call CatalogAware's manage_afterAdd function from within
>my new class's manage_afterAdd function, but whenever I try it, I get
>
>Error Type: TypeError
>Error Value: unbound method must be called with class instance 1st argument
>
>My code looks like this:
>
>class BasicGroup(CatalogAware, LogAware):
>     meta_type = 'BasicGroup'
>
>     def manage_afterAdd(self, item, container):
>         CatalogAware.manage_afterAdd(self, item, container)
>         ...
>
>Any ideas?

This is because of ExtenionClasses, the python interpreter is confused 
about wether or not you are passing in a proper Class instance.

To work around this check, call the unbound method:

   CatalogAware.manage_afterAdd.im_func(self, item, container)


--
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
------------------------------------------