At Friday 20/1/2006 20:07, Jeff Gentry wrote:

As background, the primary class (A) maintains a handle to an instance of
another class (B) which handles interaction w/ a psycopg db
controller.  Class A also will instantiate several instances of Class C
and as part of the construction will pass it the handle to class B.  So in
summary, A has a B and has 1:n C's, and C has a reference to B.  A & B
have physical representations in the ZMI, while instances of C are

If you follow these rules you should be safe:

- Never store a reference to a persistent object inside another persistent object; use its id or path to retrieve it when needed. - Never store a reference to a persistent object inside a non-persistent object. - If a persistent object "owns" some other persistent objects, make the first an ObjectManager.
- Let Zope manage transactions, and avoid bare try/excepts

Of course you can break the rules if you really really know what you are doing but they are a good starting point. And reading about how persistence works is a big help (it appears you've already read it, I think).

Gabriel Genellina
Softlab SRL
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to