[Zodb-checkins] CVS: StandaloneZODB/ZODB - PersistentMapping.py:1.13.2.4

Guido van Rossum guido@python.org
Sat, 26 Jan 2002 22:39:44 -0500


Update of /cvs-repository/StandaloneZODB/ZODB
In directory cvs.zope.org:/tmp/cvs-serv32089

Modified Files:
      Tag: StandaloneZODB-1_0-branch
	PersistentMapping.py 
Log Message:
Fix 2.0 compatibility: only define popitem if it exists in UserDict.


=== StandaloneZODB/ZODB/PersistentMapping.py 1.13.2.3 => 1.13.2.4 ===
     __super_update = UserDict.update
     __super_setdefault = UserDict.setdefault
-    __super_popitem = UserDict.popitem
 
     def __delitem__(self, key):
         self.__super_delitem(key)
@@ -64,9 +63,14 @@
             self._p_changed = 1
         return self.__super_setdefault(key, failobj)
 
-    def popitem(self):
-        self._p_changed = 1
-        return self.__super_popitem()
+    try:
+        __super_popitem = UserDict.popitem
+    except AttributeError:
+        pass
+    else:
+        def popitem(self):
+            self._p_changed = 1
+            return self.__super_popitem()
 
     # If the internal representation of PersistentMapping changes,
     # it causes compatibility problems for pickles generated by