RE: [Zope] Calling ZClass constructors programmatically...
For some reason, it doesn't work (at least for my ZClass, which subclasses ZCatalog:CatalogAware, and OFS:Folder), with code like: container.manage_addProduct['Classifieds'].AdFolder_add(...) I can't seem to publish 'Classifieds' - I get an AttributeError in Product.py for 'Classifeds'. Classifieds is a product created (only) within the ODB and contains a few ZClasses. The thing that seems strange is that this technique works fine for OFS:Folder: container.manage_addProduct['OFSP'].manage_addFolder(...) I feel fairly confident that if the container.manage_addProduct['Classifieds'] namespace could be published (shouldn't it be able to be seen?), that I would have no problem calling its constructor this way. I may end up swithching my project to the product API instead of using ZClasses just to avoid all this confusion, though; I've just already spent a bunch of time setting up Sean -----Original Message----- From: Dieter Maurer [mailto:dieter@handshake.de] Sent: Friday, April 20, 2001 11:40 AM To: sean.upton@uniontrib.com Cc: zope@zope.org Subject: Re: [Zope] Calling ZClass constructors programmatically... sean.upton@uniontrib.com writes:
I have been trying a bunch of different things to instantiate a ZClass instance... The documentation (Zope help -> API-Reference -> ObjectManager) speaks of a standard way to instantiate anything:
<container>.manage_addProduct[<product_name>].<constructor>(....) Have you tried it? Dieter _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
sean.upton@uniontrib.com writes:
For some reason, it doesn't work (at least for my ZClass, which subclasses ZCatalog:CatalogAware, and OFS:Folder), with code like:
container.manage_addProduct['Classifieds'].AdFolder_add(...)
I can't seem to publish 'Classifieds' - I get an AttributeError in Product.py for 'Classifeds'. It this a typo? "Classifeds" versus "Classifieds"?
I just tried it with my ZClass: <dtml-with "manage_addProduct['Test']"> <dtml-var ZF_addForm> </dtml-with> Works as it should do. My class is derived from ZObject and ZFolder. Dieter
participants (2)
-
Dieter Maurer -
sean.upton@uniontrib.com