[Zope] How to make a Python Product Class a BaseClass for ZClasses

Martijn Faassen m.faassen@vet.uu.nl
Wed, 03 Nov 1999 12:00:00 +0100


Stephan Richter wrote:
> 
> hello everyone,
> 
> how can I make a python product ZClass like ZPickle and so on a BaseClass for
> ZClasses.
> 
> I know I have to write context.registerBaseClass(ZPickle.ZPickle). But that
> alone will not do it. Can someone help me, please?

Hm, but that works for me. I just do in __init__.py:

import foo

def initialize(context):
    context.registerBaseClass(foo.MyClass)

Are you sure your __init__.py works? I've noticed a lack of Zope error
messages when you make a typo in __init__.py, or refer to nonexisting
classes etc.

After that, you restart your Zope, and then you should be able to use
the base class when you create a ZClass. Note that I've always inherited
from simple Python classes instead of full fledged Zope products.
Anthony Pfrunder has experience doing the latter I believe, so you may
want to ask him.

Regards,

Martijn