[Zope] Creating a ZClass instance via an external method

Small Business Services toolkit at magma.ca
Tue Jun 8 11:49:27 EDT 2004


I am trying to create a ZClass instance via an external method.

I have created a 'non-CatalogAware' ZClass called 'WebSites'.  I can create,
via the ZMI, an instance of the ZClass with no problem. However, when I try
to create an instance via an external method I get an error.

Here is the external method:

def mytest(self):
       recid = "100"
       newobj =
self.WebSitesChildData.manage_addProduct['SWV2'].WebSites.createInObjectMana
ger(self, recid, REQUEST)
       return newobj

where SWV2 is the product name; WebSitesChildData is the folder where I want
the ZClass instance to be created; and 'recid' is the id I want to give the
ZClass instance.

The error I get is:

Traceback (innermost last):
  Module ZPublisher.Publish, line 98, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 39, in call_object
  Module Products.ExternalMethod.ExternalMethod, line 224, in __call__
   - __traceback_info__: ((<Folder instance at 843e830>,), {}, None)
  Module /apps/zope/Extensions/jhtmp.py, line 15, in jhtmp
  Module ZClasses.ZClass, line 449, in createInObjectManager
  Module ZPublisher.mapply, line 77, in mapply
AttributeError: get


I am at a loss, because the createInObjectManager call works from the
WebSites_add constructor, but not when called from the external method.

Any ideas greatly appreciated!

Jonathan





More information about the Zope mailing list