[Zope] Newbie ZClass confusion
Patrick Stinson
ajole-1@gci.net
Tue, 3 Dec 2002 13:14:46 -0000
The following is a python constructor that I usually use. I call this
constructor from an html form that sets all of the new object's properties.
notice the 'ProductName' and 'ZClassName' (fill those in).
---------------------------------------------------------------
#board=context.manage_clone(container.messageBoardTemplate, id)
board=context.manage_addProduct['ProductName'].ZClassName.createInObjectMana
ger(REQUEST['id'], REQUEST)
board.propertysheets.common.manage_editProperties(REQUEST)
if REQUEST is not None:
try: u=context.DestinationURL()
except: u=REQUEST['URL1']
REQUEST.RESPONSE.redirect(u+'/manage_main?update_menu=1')
------------------------------------------------------------
This will create a new object of the class you specified in the folder you
called it from.
-----Original Message-----
From: Patrick Stinson [mailto:ajole-1@gci.net]
Sent: Tuesday, December 03, 2002 1:14 PM
To: toman
Subject: RE: [Zope] Newbie ZClass confusion
The following is a python constructor that I usually use. I call this
constructor from an html form that sets all of the new object's properties.
notice the 'ProductName' and 'ZClassName' (fill those in).
---------------------------------------------------------------
#board=context.manage_clone(container.messageBoardTemplate, id)
board=context.manage_addProduct['ProductName'].ZClassName.createInObjectMana
ger(REQUEST['id'], REQUEST)
board.propertysheets.common.manage_editProperties(REQUEST)
if REQUEST is not None:
try: u=context.DestinationURL()
except: u=REQUEST['URL1']
REQUEST.RESPONSE.redirect(u+'/manage_main?update_menu=1')
------------------------------------------------------------
This will create a new object of the class you specified in the folder you
called it from.
-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of toman
Sent: Wednesday, December 04, 2002 12:59 AM
To: zope@zope.org
Subject: [Zope] Newbie ZClass confusion
Hi,
I'm a little confused about ZClass construction.
I have a product 'Lucy' which has folderish ZClasses 'bob' and 'bill' in
it. Each instance of a bob should be constructed with a bill named
'Willliam' in it.
The default DTML method bob_add has the following snippet:
<dtml-with "bob.createInObjectManager(REQUEST['id'], REQUEST)">
<dtml-comment>
...
</dtml-comment>
</dtml-with>
Where and how do I construct the bill ? My naive thought
was to put a <dtml-call "bill_add(id='William')"> in the
dtml-with statement, but that doesn't seem to work. Suggestions?
I've read 'The Zope Book' a couple times, looked through ZopeLabs and
didn't see anything like this except for adding a folder, which isn't
that helpful because they're a standard class and have various
management methods defined for them. Ideas?
J. Toman
_______________________________________________
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 )