[Zope] Adding a ZClass instance in python
Gilles Lenfant
glenfant@bigfoot.com
Thu, 30 Aug 2001 23:46:40 +0200
Hi,
I've read this How-To
http://www.zope.org/Members/tazzzzz/addZClasses
But I'm deadly trying to do this in a python script (that's not a ZClass
method and does not reside in a product), an not in an external method.
I've deeply tried to find a way but did not succed.
The creation of ZClass instances through ZMI works perfectly , through the
usual MyProduct/MyZClass_addForm and MyZClass_add
All I do is this (translation into python script of the DTML method from
above mentioned URL):
context.REQUEST.set('id', myNewId)
context.manage_addProduct['MyProduct'].MyZClass_add(_.None, NoRedir=1)
return 'Done'
I got this...
Error Type: NameError
Error Value: MyZClass
[VERY LONG TRACEBACK FINISHING WITH]
(Object: MyZClass_add)
File
/usr/local/Zope-2.3.3-linux2-x86/lib/python/DocumentTemplate/DT_With.py,
line 138, in render
(Object: MyZClass.createInObjectManager(REQUEST['id'], REQUEST))
File
/usr/local/Zope-2.3.3-linux2-x86/lib/python/DocumentTemplate/DT_Util.py,
line 339, in eval
(Object: MyZClass.createInObjectManager(REQUEST['id'], REQUEST))
(Info: REQUEST)
File <string>, line 0, in ?
NameError: (see above)
Does someone have an idea ?
Many thanks in advance !
--Gilles