Zope-2.8.1, LocalFS, and the importance of _p_jar
I've encountered the issue described here: http://mail.zope.org/pipermail/zope/2005-August/161120.html on a recently upgraded Zope using LocalFS. I have tracked down the issue to the fact that the object that LocalFS "hands" to ZODB is a WrapperObject, and this object does not have an oid. This raises an AssertionError during the _commit method of ZODB.Connection. I have traced the code a little bit and I see that this block of code will be avoided for these objects if the objects do not appear in self._registered_objects, which I can achieve by making sure that the object has no _p_jar attribute. If I comment out the line in the LocalFS object where the wrapper object's _p_jar is set to the parent object's _p_jar, everything works fine, with no (apparent) problems. [ I tried also setting obj._p_oid = self._p_oid, but then Zope has pickling problems trying to pickle instances of the wrapper class ]. The problem I have with my "solution" is that I have no clue what _p_jar is. What is _p_jar used for within the Zope model? What are the implications of having an object with self._p_jar=None? What are the implications of a transient object (not stored in the ZODB but on the local filesystem), with self._p_jar=None? Thanks in advance for any information, John Ziniti
John Ziniti wrote:
The problem I have with my "solution" is that I have no clue what _p_jar is.
It's all to do with ZODB persistence. I'm not sure why the wrapper was ever given a _p_jar, it's probably not a good idea, but then LocalFS is very old but was very good at the time, so there's likely to be a good reason for it to be there :-S I dunno, try contact Jonathan Farr, the product's author and see if he can remember. Other than that, maybe ask on zodb-dev@zope.org about any problems you may experience from removing it :-S My wories aren't so much about persistence, but whether these wrappers will play nicely with the transation framework without a _p_jar. They should, but I wouldn't want to bet on it... good luck! Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
John Ziniti wrote at 2005-11-22 13:26 -0500:
I've encountered the issue described here:
http://mail.zope.org/pipermail/zope/2005-August/161120.html
on a recently upgraded Zope using LocalFS. I have tracked down the issue to the fact that the object that LocalFS "hands" to ZODB is a WrapperObject, and this object does not have an oid. This raises an AssertionError during the _commit method of ZODB.Connection.
Congratulation!
.... The problem I have with my "solution" is that I have no clue what _p_jar is.
It is the ZODB connection a persistent object was loaded from. Only a persistent object (which come from the ZODB) should have it. Non persitent wrappers should lack it. -- Dieter
participants (3)
-
Chris Withers -
Dieter Maurer -
John Ziniti