Inheritance glitches?
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? -- Benno Rice "No, no. We're *sweet* and XNFP Aries Dark Subculture- *innocent* evil bastards." friendly Internet Geek benno@netizen.com.au "Defend your joy"
On Fri, Oct 22, 1999 at 04:59:14PM +1000, 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?
Ok, it seems that ZClasses aren't classes. That's a pain. Is there any way around this? -- Benno Rice "No, no. We're *sweet* and XNFP Aries Dark Subculture- *innocent* evil bastards." friendly Internet Geek benno@netizen.com.au "Defend your joy"
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 ------------------------------------------
participants (2)
-
Benno Rice -
Martijn Pieters