[Zope] persistent object with non-persistent attributes

Jerome Alet alet@librelogiciel.com
Tue, 4 Mar 2003 11:14:56 +0100


On Tue, Mar 04, 2003 at 09:30:53AM +0000, Toby Dickenson wrote:
> On Tuesday 04 March 2003 9:22 am, Jerome Alet wrote:
> 
> Zope uses (by default) four publishing threads. That means you will get four 
> copies of your objects in memory at any one time (or 8, if you have 2 zeo 
> clients). You also have the possibility of ZODB choosing to deactivate your 
> object, so all attributes are lost from all 4 of those objects.
> 
> 'hardware plug&play' makes me think this is this what you want... Perhaps 
> storing this special object in a module-level global would be better?

but I must be sure that only one thread deals with the hardware at
a time.

> >   myZopePersistentClassInstance.complexAttr = myNonZopeClass()
> >
> > but this will probably, if it works, bloat by ZODB.
> >
> > is there a way to do this without suffering from severe bloat ?
> 
> myZopePersistentClassInstance._v_complexAttr = myNonZopeClass()
> 
> will exclude that attribute from ZODB processing.

This is perfect ! But now how can I be use that no other thread
access the hardware at the same time ? (if possible a single
device open at Zope start or on-demand would be fine)

I actually use a CGI script for this, but I wondered if using
Zope instead wouldn't make it more "reactive".

Thanks in advance.

Jerome Alet