[Checkins] SVN: Products.BTreeFolder2/trunk/ Change implementation of `keys`, `items` and `values` method to access the `self._tree` OOBTree methods directly. This avoids lookups in the meta_types structures.
Hanno Schlichting
hannosch at hannosch.eu
Sun Jul 11 08:47:05 EDT 2010
Log message for revision 114590:
Change implementation of `keys`, `items` and `values` method to access the `self._tree` OOBTree methods directly. This avoids lookups in the meta_types structures.
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 2010-07-11 12:40:47 UTC (rev 114589)
+++ Products.BTreeFolder2/trunk/CHANGES.txt 2010-07-11 12:47:04 UTC (rev 114590)
@@ -4,6 +4,10 @@
2.13.0 (unreleased)
-------------------
+- Change implementation of `keys`, `items` and `values` method to access the
+ `self._tree` OOBTree methods directly. This avoids lookups in the meta_types
+ structures.
+
- Implement the full dictionary protocol including `__getitem__`,
`__delitem__`, `__setitem__`, `__nonzero__`, `__iter__` and `__contains__`.
Modified: Products.BTreeFolder2/trunk/src/Products/BTreeFolder2/BTreeFolder2.py
===================================================================
--- Products.BTreeFolder2/trunk/src/Products/BTreeFolder2/BTreeFolder2.py 2010-07-11 12:40:47 UTC (rev 114589)
+++ Products.BTreeFolder2/trunk/src/Products/BTreeFolder2/BTreeFolder2.py 2010-07-11 12:47:04 UTC (rev 114590)
@@ -345,6 +345,10 @@
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
@@ -358,6 +362,10 @@
# match 'spec'.
return LazyMap(self._getOb, self.objectIds(spec))
+ security.declareProtected(access_contents_information, 'values')
+ def values(self):
+ return self._tree.values()
+
security.declareProtected(access_contents_information, 'objectItems')
def objectItems(self, spec=None):
# Returns a list of (id, subobject) tuples of the current object.
@@ -366,6 +374,10 @@
return LazyMap(lambda id, _getOb=self._getOb: (id, _getOb(id)),
self.objectIds(spec))
+ security.declareProtected(access_contents_information, 'items')
+ def items(self):
+ return self._tree.items()
+
security.declareProtected(access_contents_information, 'objectMap')
def objectMap(self):
# Returns a tuple of mappings containing subobject meta-data.
@@ -453,11 +465,6 @@
def __delitem__(self, name):
return self._delObject(id=name)
- # Aliases for mapping-like access.
- keys = objectIds
- values = objectValues
- items = objectItems
-
# backward compatibility
hasObject = has_key
More information about the checkins
mailing list