> Whatever you are doing, you are doing the "wrong
> You are instantiating persistent objects and not storing
> them in the
> ZODB. This is going to cause your ZODB to grow, so you
> might as well
> store them.
> Otherwise you need to make non-persistent versions of the
> objects you
> are trying to 'cache' and use those instead.
> Andrew Milton
> [EMAIL PROTECTED]
Not exactly. I am instantiating non persistent objects that do have a reference
to persistence objects in the form of an attribute, and then trying to cache
those non persistent objects.
Do the fact that these non persistent objects store a reference to persistent
ones turn them into persistent ? I am curious to know.
Anyway, I tried the volatile attribute thing
(http://wiki.zope.org/ZODB/VolatileAttributes) and first tests look fine.
This is how I did the trick :
from OFS.SimpleItem import SimpleItem
from NonZODBObject import NonZODBObject
class ZODBLivingObject(SimpleItem) :
Hello, I live in the ZODB.
meta_type = "ZODBish"
self.id = "ZODBish"
self.title = "ZODBish"
# NonZODBObject stores a reference of self, a ZODB-living object.
nonZODBish = NonZODBObject(self)
# This line breaks everything. Comment it and every thing will be just
# This can be seen in the console if runzope
print "it's me",nonZODBish.context
if not hasattr(self,"_v_NonZODBish"):
And then I use the setNonZODBish et getNonZODBish methods to set and access the
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -