[Zope] Question regarding InvalidObjectReference and the storing of objects in the session

Dieter Maurer dieter@handshake.de
Thu, 17 Jul 2003 21:25:38 +0200


Alec Munro wrote at 2003-7-16 16:22 -0300:
 > I've had a system where I was storing object URLs in the session, and 
 > using restrictedTraverse to access the objects. ...
 > ... bypass this step and simply store the objects 
 > themselves in the session.

Zope 2.6.1 will (probably) allow you to do that *BUT*
it will not work as you expect!

  As Chris pointed out, the session and your object live in
  different ZODBs (with separate object id spaces).

  The ZODB does not support inter-ZODB references (its references
  use simply the object id and they are not unique in different
  ZODB's).

  Therefore, when you store an object from one ZODB in another
  one, the object (and all its descendants) is copied (in Zope 2.6.1).
  When you copy a folder in this way, your session may get huge.
  Moreover, as it creates a copy, changes to one copy are not 
  propagated to another one.


Forget about this road...


Dieter