[Zope] Re: Class instances changing address?
Florent Guillaume
fg at nuxeo.com
Fri Jan 20 05:20:56 EST 2006
Jeff Gentry wrote:
> I'm running Zope 2.7.3 w/ python 2.4.1. I'm in the process of developing
> a FS based product as a primary class w/ many sub-classes. I've been
> experiencing a problem which I thought I had completely nixed but
> apparently only partly so and now am out of ideas as to what might be the
> source of the problem.
>
> 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
> 'virtual'.
We say that A and B are persistent classes, while C is not.
You have to be aware that persistent classes have special needs, and using
them has consequences. One being that, due to transactional behaviour,
several versions of the same instance of an object may be present in the
system, in different threads, for different requests. They'll have different
addresses.
Also be aware that it doesn't make sense for a non-persistent class to refer
to a persistent instance unless it knows that they can be thread-specific.
Florent
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope
mailing list