[Zope] Re: Class instances changing address?

2006-01-20 Thread Florent Guillaume

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 RD
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Class instances changing address?

2006-01-20 Thread Jeff Gentry

On Fri, 20 Jan 2006, Florent Guillaume wrote:
 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.

Interesting, and led me to some reading of topics that I didn't even know
existed.  One thing to note though, this afternoon I reimplemented the
handling of 'C' such that they have physical representations in the ZMI (I
had them subclass SimpleItem and then performed a _setObject() in a Folder
inside the 'A' instance) and this was still happening.  

I've seen a few comments suggesting that poor handling of Acquisition
could be my downfall here so perhaps indeed it wasn't the persistence
issue but acquisition instead?

Thanks
-J


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )