[Zope] object references in python (script)

Hans N. Beck HNBeck@t-online.de
Wed, 7 Nov 2001 14:14:37 +0100


Hi all,

I've no idea where may be an error at the folling code:

----
 # create a unique  id
 id= str(linkname) + str( len(context.objectIds()))

 # add new instance of DokuTypeID (hint from mailing list)
 context.REQUEST.set('id', id)
 my_context= context.manage_addProduct['DokuItem']
 my_context.DokuTypeID_add(my_context,context.REQUEST, NoRedir=1)

 # add a guest_name string property (variant of the guestbook example in
Zope Book)
 context.REQUEST.set('keyword',id)
 doc=getattr(context, id)
 doc.manage_changeProperties(context.REQUEST)
----

DokuItem is a own product, containing the class DokuTypeID, which has
the property 'keyword'. Assume the code has to create an instance
in folder "anything". Instance is created - good. But not the
property of the new DokuTypeID instance is set, the property of
the folder "anything" (which also has the property "keyword") is
overwritten. ??????? So it seems, the variable doc points to the
folder object, not to the new instance in it. Why ????

Thanks for help!

Greetings

Hans



-----------------------------------
 Dipl.-Ing. Hans N. Beck
 Waldstr. 28 75045 Walzbachtal

 Tel:   07203/922280
 Mobil: 0177/5383233
 -----------------------------------