[Zope-dev] Inheritance problems with ZClasses with Python base classes - workaround

Itamar Shtull-Trauring itamars@ibm.net
Thu, 16 Dec 1999 21:47:21 +0200


In short, and I haven't verified it in a test case, if your ZClass inherits
from both ZClasses and from regular python classes, the python classes must
be first, or you won't be able to access the python classes methods. 
Instead you might get a "missing doc string" error, or perhaps some other
error.

I need to try this with a simpler test case, but simply changing the order
of inheritance in my ZClass so python classes were first solved my problem. 
And yes, all my functions had doc strings and yes, the methods that didn't
work originally were only defined in the python classes.

What I tried, proof of my claim:

CatalogAware python class -> Workflow python class -> ZWorkflow ZClass

ObjectManager python class -> OrderedObjectManager python class (mine) ->
Foodbase pytohn class

and then Food inherited from ZWorkflow and FoodBase.

This didn't work. 
 ****** But inheriting directly from just Workflow and FoodBase did work - 
*******
 ******* wrapping Workflow in a ZClass is what caused my problem           
*******

Inheritng directly from Workflow, then from a new plain-vanilla ZClass I
created and then from FoodBase didn't work.

So I change the order:
Inheriting from Workflow, then FoodBase (both python classes), then from the
ZClass solved the problem!

-- 
Itamar S.T.  itamars@ibm.net