[Checkins] SVN: Products.BTreeFolder2/trunk/ `keys`, `values` and `items` methods are now exactly the same as `objectIds`, `objectValues` and `objectItems`. They did the same before already but duplicated the code.

Michael Howitz mh at gocept.com
Tue Mar 15 04:26:59 EDT 2011


Log message for revision 120935:
  `keys`, `values` and `items` methods are now exactly the same as `objectIds`, `objectValues` and `objectItems`. They did the same before already but duplicated the code.
  
  

Changed:
  U   Products.BTreeFolder2/trunk/CHANGES.txt
  U   Products.BTreeFolder2/trunk/src/Products/BTreeFolder2/BTreeFolder2.py

-=-
Modified: Products.BTreeFolder2/trunk/CHANGES.txt
===================================================================
--- Products.BTreeFolder2/trunk/CHANGES.txt	2011-03-15 03:10:43 UTC (rev 120934)
+++ Products.BTreeFolder2/trunk/CHANGES.txt	2011-03-15 08:26:59 UTC (rev 120935)
@@ -4,12 +4,17 @@
 2.13.3 (unreleased)
 -------------------
 
+- `keys`, `values` and `items` methods are now exactly the same as
+  `objectIds`, `objectValues` and `objectItems`. They did the same before
+  already but duplicated the code.
 
+
 2.13.2 (2011-03-08)
 -------------------
 
 - `objectValues` and `objectItems` no longer do a special handling when no
-  special `spec` is requested as `objectIds` already does the correct handling.
+  special `spec` is requested as `objectIds` already does the correct
+  handling.
 
 2.13.1 (2010-08-04)
 -------------------

Modified: Products.BTreeFolder2/trunk/src/Products/BTreeFolder2/BTreeFolder2.py
===================================================================
--- Products.BTreeFolder2/trunk/src/Products/BTreeFolder2/BTreeFolder2.py	2011-03-15 03:10:43 UTC (rev 120934)
+++ Products.BTreeFolder2/trunk/src/Products/BTreeFolder2/BTreeFolder2.py	2011-03-15 08:26:59 UTC (rev 120935)
@@ -369,10 +369,6 @@
         else:
             return set.keys()
 
-    security.declareProtected(access_contents_information, 'keys')
-    def keys(self):
-        return self._tree.keys()
-
     def __contains__(self, name):
         return name in self._tree
 
@@ -386,10 +382,6 @@
         # match 'spec'.
         return LazyMap(self._getOb, self.objectIds(spec))
 
-    security.declareProtected(access_contents_information, 'values')
-    def values(self):
-        return LazyMap(self._getOb, self._tree.keys())
-
     security.declareProtected(access_contents_information, 'objectItems')
     def objectItems(self, spec=None):
         # Returns a list of (id, subobject) tuples of the current object.
@@ -398,10 +390,11 @@
         return LazyMap(lambda id, _getOb=self._getOb: (id, _getOb(id)),
                        self.objectIds(spec))
 
-    security.declareProtected(access_contents_information, 'items')
-    def items(self):
-        return LazyMap(lambda id, _getOb=self._getOb: (id, _getOb(id)),
-                       self._tree.keys())
+    security.declareProtected(
+        access_contents_information, 'keys', 'items', 'values')
+    keys = objectIds
+    values = objectValues
+    items = objectItems
 
     security.declareProtected(access_contents_information, 'objectMap')
     def objectMap(self):



More information about the checkins mailing list