Commit 4654bb13 authored by Jim Fulton's avatar Jim Fulton

Fixed a bug that messed up ZClass persistence.

parent a9db74f4
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
############################################################################## ##############################################################################
"""Database connection support """Database connection support
$Id: Connection.py,v 1.14 1999/07/07 10:58:47 jim Exp $""" $Id: Connection.py,v 1.15 1999/07/07 19:52:28 jim Exp $"""
__version__='$Revision: 1.14 $'[11:-2] __version__='$Revision: 1.15 $'[11:-2]
from cPickleCache import PickleCache from cPickleCache import PickleCache
from POSException import ConflictError, ExportError from POSException import ConflictError, ExportError
...@@ -402,31 +402,35 @@ class Connection(ExportImport.ExportImport): ...@@ -402,31 +402,35 @@ class Connection(ExportImport.ExportImport):
def setklassstate(self, object, def setklassstate(self, object,
tt=type(()), ct=type(HelperClass)): tt=type(()), ct=type(HelperClass)):
oid=object._p_oid try:
__traceback_info__=oid oid=object._p_oid
p, serial = self._storage.load(oid, self._version) __traceback_info__=oid
file=StringIO(p) p, serial = self._storage.load(oid, self._version)
unpickler=Unpickler(file) file=StringIO(p)
unpickler.persistent_load=self._persistent_load unpickler=Unpickler(file)
unpickler.persistent_load=self._persistent_load
copy = unpickler.load()
copy = unpickler.load()
klass, args = copy
klass, args = copy
if klass is not ExtensionKlass:
LOG('ZODB',ERROR, if klass is not ExtensionKlass:
"Unexpected klass when setting class state on %s" LOG('ZODB',ERROR,
% getattr(object,'__name__','(?)')) "Unexpected klass when setting class state on %s"
return % getattr(object,'__name__','(?)'))
return
copy=apply(klass,args)
object.__dict__.clear() copy=apply(klass,args)
object.__dict__.update(copy.__dict__) object.__dict__.clear()
object.__dict__.update(copy.__dict__)
object._p_oid=oid
object._p_jar=self object._p_oid=oid
object._p_changed=None object._p_jar=self
object._p_serial=serial object._p_changed=0
object._p_serial=serial
except:
LOG('ZODB',ERROR, 'setklassstate failed', error=sys.exc_info)
raise
def tpc_abort(self, transaction): def tpc_abort(self, transaction):
self._storage.tpc_abort(transaction) self._storage.tpc_abort(transaction)
......
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