[Zope-dev] Why is ZEvent not ZClass subclassable?

Michel Pelletier michel@digicool.com
Tue, 07 Mar 2000 12:06:39 -0800


Loren Stafford wrote:
> 
> I still haven't found an answer to this question. Anyone have any idea why
> or how to figure out?
> 
> Below is the code that defines the ZEvent class (minus some of its methods)
> 
> >
> 
> class BaseZEvent(CatalogAware, DTMLMethod):

    " synatically legal snip "
 
> class OneTimeZEvent(BaseZEvent):
>   #meta_type = 'Onetime ZEvent'
> 
> default__class_init__(OneTimeZEvent)
> 
> # code that registers above class
>       context.registerClass(
>         ZEvent.OneTimeZEvent,
>         permission = 'Add ZEvent',
>         constructors = (
>           ZEvent.manage_addOneTimeZEventForm,
>           ZEvent.manage_addOneTimeZEvent),
>         icon = 'www/OneTimeZEvent.gif')


Loren, first, there is no 'def initialize(context)" here.  The last
stanza of your code is actually syntacically incorrect.  I don't see how
you are defining a fucntion.  Second, I don't see you calling
context.registerBaseClass.  Third, your initialize function should be in
your Product's __init__.py file.  Examine
lib/python/Products/ZCatalog/__init__.py to see how ZCatalog registers
itself and CatalogAwareness as Base Classes.

Also, I posted a message to the list a while back explaining this, you
might want to read that.

-Michel