Dario Lopez-Kšsten wrote at 2004-6-13 12:43 +0200:
>I am am worrying a problem here, where I need to store references to 
>objects in my own objects, while at the same time needing to store and 
>retreive my objects later.

Your problem can be summarized by "storing acquisition wrappers
(of persistent objects) across requests".

This is very difficult!
You have a very good chance to get burned.

You cannot store them in the ZODB as acquisition wrappers cannot
be stored there. Currently, the ZODB silently unmantles
acquisition wrappers. They may be rebound on access -- but
this will not give you the original acquisition context and
behaviour can be drastically different.

You cannot store them via module global data structures
as the values (indirectly) reference persitent objects.
You must never put persistent objects outside the scope of its ZODB
connection as this will give nasty (non deterministic) persistency bugs.

You could store such values as volatile attributes ("_v_")
of persistent objects. However, volatile attributes
are not completely reliable (as the name suggests).
And they are (ZODB) connection local -- another connection does not
see them.

You may put such objects into attributes of the ZODB connection
itself. Again, they will be connection local.

Urgent recommendation: avoid storing acquisition wrapped objects
across requests, store paths instead and locate the objects by
means of the paths.


Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to