[Zodb-checkins] SVN: ZODB/branches/3.4/ merging revision 40330 from
trunk:
Thomas Lotze
tl at gocept.com
Tue Nov 22 16:07:45 EST 2005
Log message for revision 40331:
merging revision 40330 from trunk:
- fixed the API of the pop() method on PersistentDict and PersistentMapping
- no longer try to find pop and popitem on UserDict as all supported
Python versions have them
- added a test for the default argument of pop()
- added a NEWS.txt entry about pop()
Changed:
U ZODB/branches/3.4/NEWS.txt
U ZODB/branches/3.4/src/persistent/dict.py
U ZODB/branches/3.4/src/persistent/mapping.py
U ZODB/branches/3.4/src/persistent/tests/test_mapping.py
-=-
Modified: ZODB/branches/3.4/NEWS.txt
===================================================================
--- ZODB/branches/3.4/NEWS.txt 2005-11-22 20:55:47 UTC (rev 40330)
+++ ZODB/branches/3.4/NEWS.txt 2005-11-22 21:07:44 UTC (rev 40331)
@@ -1,3 +1,19 @@
+What's new in ZODB3 3.4.3b1?
+==========================
+Release date: DD-MMM-2005
+
+Following are dates of internal releases (to support ongoing Zope 2
+development) since ZODB 3.4's last public release:
+
+- 3.4.3b1 DD-MMM-2005
+
+PersistentMapping
+-----------------
+
+- (3.4.3b1) The ``PersistentMapping`` makes changes by a ``pop()`` method call
+ persistent now.
+
+
What's new in ZODB3 3.4.2?
==========================
Release date: 12-Oct-2005
Modified: ZODB/branches/3.4/src/persistent/dict.py
===================================================================
--- ZODB/branches/3.4/src/persistent/dict.py 2005-11-22 20:55:47 UTC (rev 40330)
+++ ZODB/branches/3.4/src/persistent/dict.py 2005-11-22 21:07:44 UTC (rev 40331)
@@ -73,9 +73,9 @@
self._p_changed = True
return self.__super_setdefault(key, failobj)
- def pop(self, i):
+ def pop(self, key, *args):
self._p_changed = True
- return self.__super_pop(i)
+ return self.__super_pop(key, *args)
def popitem(self):
self._p_changed = True
Modified: ZODB/branches/3.4/src/persistent/mapping.py
===================================================================
--- ZODB/branches/3.4/src/persistent/mapping.py 2005-11-22 20:55:47 UTC (rev 40330)
+++ ZODB/branches/3.4/src/persistent/mapping.py 2005-11-22 21:07:44 UTC (rev 40331)
@@ -41,6 +41,8 @@
__super_clear = UserDict.clear
__super_update = UserDict.update
__super_setdefault = UserDict.setdefault
+ __super_pop = UserDict.pop
+ __super_popitem = UserDict.popitem
def __delitem__(self, key):
self.__super_delitem(key)
@@ -66,23 +68,13 @@
self._p_changed = 1
return self.__super_setdefault(key, failobj)
- try:
- __super_pop = UserDict.pop
- except AttributeError:
- pass
- else:
- def pop(self, i):
- self._p_changed = 1
- return self.__super_pop(i)
+ def pop(self, key, *args):
+ self._p_changed = 1
+ return self.__super_pop(key, *args)
- try:
- __super_popitem = UserDict.popitem
- except AttributeError:
- pass
- else:
- def popitem(self):
- self._p_changed = 1
- return self.__super_popitem()
+ def popitem(self):
+ self._p_changed = 1
+ return self.__super_popitem()
# __iter__ was added in ZODB 3.4.2, but should have been added long
# before. We could inherit from Python's IterableUserDict instead
Modified: ZODB/branches/3.4/src/persistent/tests/test_mapping.py
===================================================================
--- ZODB/branches/3.4/src/persistent/tests/test_mapping.py 2005-11-22 20:55:47 UTC (rev 40330)
+++ ZODB/branches/3.4/src/persistent/tests/test_mapping.py 2005-11-22 21:07:44 UTC (rev 40331)
@@ -1,6 +1,6 @@
##############################################################################
#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
@@ -136,6 +136,9 @@
else:
raise TestFailed("1 should not be poppable from u2")
+ x = u2.pop(1, 7)
+ eq(x, 7, "u2.pop(1, 7) == 7")
+
# Test popitem
items = u2.items()
More information about the Zodb-checkins
mailing list