[Zope] Adding instances - How sending meta_type by argument ?

Dieter Maurer dieter@handshake.de
Mon, 19 Feb 2001 00:02:55 +0100 (CET)


Menard.Jean-Francois@hydro.qc.ca writes:
 > This message is in MIME format. Since your mail reader does not understand
 > this format, some or all of this message may not be legible.
 > 
 > ------_=_NextPart_001_01C09851.A21AFA20
 > Content-Type: text/plain;
 > 	charset="iso-8859-1"
Please do not send MIME messages!

 > I'm trying to create a general insert method that will be inherited by all
 > my sub-objects.  I would like to send a parameter, "type", that will
 > determine what type of object to create.
 > 
 > I tried this:
 > 
 > <dtml-with "manage_addProduct['normalisation']">
 >     <dtml-with "_[type].createInObjectManager(REQUEST['NewId'], REQUEST)">
 >       <dtml-call reindex_object>
 >     </dtml-with>
 > </dtml-with>
 > 
 > And I pass the meta-type as parameter "type".  I receive the following
 > error:
 > 
 > Error Type: AttributeError
 > Error Value: createInObjectManager
Try "_.getitem(type)".

"_[type]" calls the object, if it happens
to be callable. This can easily result in a string, at least in a 
different object type.


Dieter