DTML to create a product instance (ExternalFile)
I'm new to Zope and am having a lot of problems figuring out how to do something in DTML which I expect should be relatively simple. I have a product called ExternalFile installed. I want to be able to create a new instance of this object based on information supplied by the user in a form. I presume DTML is capable of doing this, but my searches have turned up nothing of help to date. I found this snippet of code from a Job Board HOWTO on the Zope site, but am not clear if I can reuse this model for ExternalFile, and what the method name might be to add a new instance of the product. <dtml-call "REQUEST.set('ts', ZopeTime())"> <dtml-call "REQUEST.set('id',_.str(_.int(ts)))"> <dtml-with "job_board_entry.createInObjectManager(REQUEST['id'], REQUEST)"> </dtml-with> I can surmise from this that REQUEST is an array that is passed to the object's createInObjectManager method. Is this method common to all objects that reside in folders? How can you find out the names of the available methods for a product? Also, the with construct is looking quite mysterious to me right now. If anyone has a sensible explanation for it that would be appreciated. Any help would be appreciated. Davis _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
davis marques writes:
I'm new to Zope and am having a lot of problems figuring out how to do something in DTML which I expect should be relatively simple.
I have a product called ExternalFile installed. The standard way to create an instance is
object_manager.manage_addProduct[product_name].constructor(constructor_arguments) "object_manager" is the container that should get your new object. "product_name" is the name of your product (in your case 'ExternalFile'). "constructor" is the constructor. It is usually called "manage_addXXX" where "XXX" is the class. But not all products follow the convention. Look at the product documentation! "constructor_arguments" are the arguments the constructor expects. Again, look at its documentation. I know that you can read something like this in <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> I expect that you find it in the Zope Book, too: <http://www.zope.org/Documentation/ZopeBook> Dieter
participants (2)
-
davis marques -
Dieter Maurer