Commit 403321d4 authored by Jim Fulton's avatar Jim Fulton

Changed to log any error when loading an objects state, including

storage errors.
parent 96d783ca
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
############################################################################## ##############################################################################
"""Database connection support """Database connection support
$Id: Connection.py,v 1.27 1999/10/07 14:17:50 jim Exp $""" $Id: Connection.py,v 1.28 1999/10/07 22:41:01 jim Exp $"""
__version__='$Revision: 1.27 $'[11:-2] __version__='$Revision: 1.28 $'[11:-2]
from cPickleCache import PickleCache from cPickleCache import PickleCache
from POSException import ConflictError, ExportError from POSException import ConflictError, ExportError
...@@ -384,8 +384,7 @@ class Connection(ExportImport.ExportImport): ...@@ -384,8 +384,7 @@ class Connection(ExportImport.ExportImport):
def root(self): return self['\0\0\0\0\0\0\0\0'] def root(self): return self['\0\0\0\0\0\0\0\0']
def setstate(self,object): def setstate(self,object):
# Note, we no longer mess with the object's state try:
# flag, _p_changed. This is the object's job.
oid=object._p_oid oid=object._p_oid
invalid=self._invalid invalid=self._invalid
if invalid(oid) or invalid(None): raise ConflictError, oid if invalid(oid) or invalid(None): raise ConflictError, oid
...@@ -393,23 +392,22 @@ class Connection(ExportImport.ExportImport): ...@@ -393,23 +392,22 @@ class Connection(ExportImport.ExportImport):
file=StringIO(p) file=StringIO(p)
unpickler=Unpickler(file) unpickler=Unpickler(file)
unpickler.persistent_load=self._persistent_load unpickler.persistent_load=self._persistent_load
try:
unpickler.load() unpickler.load()
state = unpickler.load() state = unpickler.load()
except:
t, v =sys.exc_info()[:2]
LOG('ZODB',ERROR,
"Couldn't unnpickle %s" % `oid`,
error=sys.exc_info())
raise
if hasattr(object, '__setstate__'): if hasattr(object, '__setstate__'):
object.__setstate__(state) object.__setstate__(state)
else: else:
d=object.__dict__ d=object.__dict__
for k,v in state.items(): d[k]=v for k,v in state.items(): d[k]=v
object._p_serial=serial object._p_serial=serial
except:
t, v =sys.exc_info()[:2]
LOG('ZODB',ERROR, "Couldn't load state for %s" % `oid`,
error=sys.exc_info())
raise
def setklassstate(self, object, def setklassstate(self, object,
tt=type(()), ct=type(HelperClass)): tt=type(()), ct=type(HelperClass)):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment