[Zope] ObjectManager 'Contents' problem

Dieter Maurer dieter@handshake.de
Tue, 7 May 2002 21:51:30 +0200


John Hunter writes:
 > ...
 >  When I add an Address instance to a Folder, all works as expected, so
 >  I think the Address constructor and class are ok.
 > 
 >  When I add an Address instance to an instance of my Person, zope
 >  accepts it fine (no errors) but the instance does not show up in the
 >  Contents view, which displays the message 'There are currently no
 >  items in me' ...
 > ...
 > def addAddressFunction(dispatcher, id, street, city, state, zip, REQUEST=None):
 >     """
 >     Create a new address and add it to myself
 >     """
 >     n=AddressImplementation(id, street, city, state, zip)
 >     dispatcher.Destination()._setObject(id, n)
 >     if REQUEST is not None:
 >         return dispatcher.manage_main(dispatcher, REQUEST)
Looks good for me (I would probably had omitted the "Destination()",
but that should not explain the behaviour).

Apparently, "_setOb" is called on the correct object (therefore,
you now have an attribute of the correct id and trying it
again will give you the "id already in use". But "_setObject"
does not work correctly or operates on the wrong "_objects".

If the error persists, I would start debugging.
Either use a Zope/Python IDE (WingIDE, Boa Contructor, ..)
or search the mailing list archives for "pdb" to learn
how to do it with elementary means.


Dieter