Commit 54d3adc2 authored by Jim Fulton's avatar Jim Fulton

Fixed bug that caused bogus registrations when custom __setstate__

methods did setattrs.
parent 765fa2f7
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
__doc__='''Python implementation of a persistent base types __doc__='''Python implementation of a persistent base types
$Id: Persistence.py,v 1.13 1998/06/05 22:07:05 jim Exp $''' $Id: Persistence.py,v 1.14 1998/07/02 16:17:44 jim Exp $'''
# Copyright # Copyright
# #
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne # Copyright 1996 Digital Creations, L.C., 910 Princess Anne
...@@ -58,7 +58,7 @@ $Id: Persistence.py,v 1.13 1998/06/05 22:07:05 jim Exp $''' ...@@ -58,7 +58,7 @@ $Id: Persistence.py,v 1.13 1998/06/05 22:07:05 jim Exp $'''
# #
# (540) 371-6909 # (540) 371-6909
# #
__version__='$Revision: 1.13 $'[11:-2] __version__='$Revision: 1.14 $'[11:-2]
try: try:
from cPersistence import Persistent from cPersistence import Persistent
...@@ -129,18 +129,30 @@ except: ...@@ -129,18 +129,30 @@ except:
def __setattr__(self,key,value): def __setattr__(self,key,value):
' ' ' '
changed=self._p_changed
if changed:
self.__dict__[key]=value
return
k=key[:3] k=key[:3]
if k=='_p_' or k=='_v_': if k=='_p_' or k=='_v_':
self.__dict__[key]=value self.__dict__[key]=value
return return
jar=self._p_jar jar=self._p_jar
if self._p_changed is None: jar.setstate(self) if jar is None:
self.__dict__[key]=value self.__dict__[key]=value
if jar is not None: return
d=self.__dict__
if changed is None:
d['_p_changed']=1
jar.setstate(self)
d[key]=value
try: try:
get_transaction().register(self) get_transaction().register(self)
self._p_changed=1 d['_p_changed']=1
except: pass except: pass
def __changed__(self,v=-1): def __changed__(self,v=-1):
...@@ -192,6 +204,10 @@ except: ...@@ -192,6 +204,10 @@ except:
############################################################################ ############################################################################
# $Log: Persistence.py,v $ # $Log: Persistence.py,v $
# Revision 1.14 1998/07/02 16:17:44 jim
# Fixed bug that caused bogus registrations when custom __setstate__
# methods did setattrs.
#
# Revision 1.13 1998/06/05 22:07:05 jim # Revision 1.13 1998/06/05 22:07:05 jim
# Fixed bug in Persistent.__setattr__ that caused changes to # Fixed bug in Persistent.__setattr__ that caused changes to
# "volatile" attributes (starting with _v_) to cause database writes. # "volatile" attributes (starting with _v_) to cause database writes.
......
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