RE: [Zope] adding zclass instance dynamically
Correction Oliver, I RECEIVED a response from Dieter (thanks!) <quote> 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. </quote> I tried it, and it works! -----Message d'origine----- De : Oliver Frommel [mailto:oliver@aec.at] Envoyé : lundi 19 février 2001 11:49 À : zope@zope.org Objet : [Zope] adding zclass instance dynamically Hello, how can I add a ZClass depending on a form value? I have a form variable called "type" which contains the type of ZClass I want to add: the "static" way is (working): <dtml-with "manage_addProduct['MyObjects']"> <dtml-with "article1.createInObjectManager(id, REQUEST)"> <dtml-call "propertysheets.Basic.manage_editProperties(REQUEST)"> </dtml-with> </dtml-with> now the form variable "type" either contains the string "article1" or "article2". but calling <dtml-with "_[type].createInObjectManager(id, REQUEST)"> doesn't work. what's the right way to do this? thanks --Oliver _______________________________________________ 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 )
participants (1)
-
Menard.Jean-Francois@hydro.qc.ca