[Zope] Programmatically creating instances of a ZClass

Borislav borislavd@gmx.net
Wed, 04 Sep 2002 14:14:01 -0500


Gouzy Nicolas wrote:
> You can try:
> 
> container.manage_addProduct['MyProduct'].MyProduct_add()
> 
> MyProduct_add is the constructor of the ZClass MyProduct
> 

How do I pass the object id to this constructor? Seems that it reads it 
from the REQUEST, but I can't assign to REQUEST in a python script. This 
code:

context.REQUEST['id'] = myObjectId
container.manage_addProduct['MyProduct'].MyProduct_add()

produces an error:

Error Type: TypeError
Error Value: object does not support item or slice assignment

Am I missing something?

--Borislav