[Zodb-checkins] CVS: Zope3/lib/python/ZODB - Connection.py:1.60.6.2

Jeremy Hylton jeremy@zope.com
Wed, 20 Feb 2002 19:03:52 -0500


Update of /cvs-repository/Zope3/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv24576/ZODB

Modified Files:
      Tag: Zope-3x-branch
	Connection.py 
Log Message:
Make sure setstate() is robust against at object that has no _p_oid.

An attribute error on _p_oid will get caught be an except clause that
would only work if oid is defined -- but oid is bound to _p_oid.

Also put body of for loop on separate line.



=== Zope3/lib/python/ZODB/Connection.py 1.60.6.1 => 1.60.6.2 ===
 
     def setstate(self, object):
+        oid = None
         try:
             oid=object._p_oid
              
@@ -160,8 +161,9 @@
             if hasattr(object, '__setstate__'):
                 object.__setstate__(state)
             else:
-                d=object.__dict__
-                for k,v in state.items(): d[k]=v
+                d = object.__dict__
+                for k,v in state.items():
+                    d[k]=v
 
             object._p_serial=serial