[Zope-dev] Why is ZEvent not ZClass subclassable?
Martijn Pieters
mj@digicool.com
Tue, 7 Mar 2000 21:57:32 +0100
From: "Michel Pelletier" <michel@digicool.com>
> 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.
He copied the code out of the __init__.py file, out of the (bigger)
initialize function. His code works when you download it from Zope.org. I
gave him the benefit of the doubt and assumed he had forgotten to copy in
the call to registerBaseClass.
Martijn Pieters
| Software Engineer mailto:mj@digicool.com
| Digital Creations http://www.digicool.com/
| Creators of Zope http://www.zope.org/
| The Open Source Web Application Server
---------------------------------------------