[Zope] External Method and Nested ZClasses
Chris Bruce
chrisabruce@yahoo.com
Wed, 16 Jan 2002 16:29:33 -0800 (PST)
I have looked at the following example for adding a ZClass in an
EXTERNAL METHOD from (http://www.zope.org/Members/tazzzzz/addZClasses):
--------------
def addAMyZClass(self, id, REQUEST=None):
""" """
# Get the actual destination object, using the this()
# method, to be sure we get it in the right context..
self=self.this()
# Create the new instance
newob=self.Control_Panel.Products.MyProduct.MyZClass(id)
newob._setId(id)
# Set properties based on the contents of the Add form
newob.propertysheets.Basic.manage_changeProperties(REQUEST)
# Add a new Folder to the new instance
newob.manage_addFolder('foobar')
# Add the new instance to the target object
self._setObject(id, newob)
return 'OK!'
------------------
But, how do you add a nested ZClass. For instance, if MyNestedZClass
was a zclass inside of MyZClass? I have tried:
...
newob=self.Control_Panel.Products.MyProduct.MyZClass.MyNestedZClass(id)
...
But it gives me an attribute error for MyNestedZClass. I have searched
and experimented, but I can seem to get a reference to the Nested
ZClass. This seems very easy in DTML, but I can't figure it out for
external method.
Any help is GREATLY appreciated.
Thanks,
Chris
__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/