[Zope-dev] Why is ZEvent not ZClass subclassable?
Jeff K. Hoffman
jeff.hoffman@goingv.com
Tue, 7 Mar 2000 12:14:44 -0500 (EST)
On Tue, 7 Mar 2000, Loren Stafford wrote:
> I still haven't found an answer to this question. Anyone have any idea why
> or how to figure out?
[snip]
> class BaseZEvent(CatalogAware, DTMLMethod):
> meta_type = 'ZEvent'
> default_catalog = ScheduleID
>
> def __init__(self, id, title = '', file = ''):
> DTMLMethod.__init__(self, file, __name__ = id)
>
> manage_options=({'label':'Edit', 'action':'manage_main'},
> {'label':'Upload', 'action':'manage_uploadForm'},
> {'label':'View', 'action':''},
> {'label':'Proxy', 'action':'manage_proxyForm'},
> {'label':'Security', 'action':'manage_access'},
> )
> __ac_permissions__=(
> ('View management screens', (
> 'manage_editForm', 'manage', 'manage_main', 'manage_uploadForm',
> 'document_src', 'PrincipiaSearchSource')),
> ('Change DTML Methods', ('manage_edit', 'manage_upload', 'PUT')),
> ('Change proxy roles', ('manage_proxyForm', 'manage_proxy')),
> ('View', ('__call__', '')),
> ('FTP access', ('manage_FTPstat','manage_FTPget','manage_FTPlist')),
> )
>
> manage_editForm=HTMLFile('documentEdit', globals())
> manage=manage_main=manage_editDocument=manage_editForm
>
> 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')
Unless my eyes just aren't seeing something, you are missing a call to
registerBaseClass.
In the __init__.py for your Product, put:
import BaseZEvent
def initialize(context):
context.registerBaseClass(BaseZEvent.BaseZEvent,
BaseZEvent.BaseZEvent.meta_type)
Note that registerClass is NOT the same as registerBaseClass.
--Jeff
---
Jeff K. Hoffman 704.849.0731 x108
Chief Technology Officer mailto:jeff@goingv.com
Going Virtual, L.L.C. http://www.goingv.com/