[Zope-Checkins] SVN: Zope/branches/2.13/ Moved subset id calculation in `OFS.OrderSupport.moveObjectsByDelta` to a new helper method, patch by Tom Gross. This allows CMFPlone and Archetypes to re-use the OFS implementation instead of using their own copy of the modified Zope 2.7 codebase :)
Hanno Schlichting
hannosch at hannosch.eu
Sat Dec 4 15:10:20 EST 2010
Log message for revision 118710:
Moved subset id calculation in `OFS.OrderSupport.moveObjectsByDelta` to a new helper method, patch by Tom Gross. This allows CMFPlone and Archetypes to re-use the OFS implementation instead of using their own copy of the modified Zope 2.7 codebase :)
Changed:
U Zope/branches/2.13/doc/CHANGES.rst
U Zope/branches/2.13/src/OFS/OrderSupport.py
-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.13/doc/CHANGES.rst 2010-12-04 20:07:09 UTC (rev 118709)
+++ Zope/branches/2.13/doc/CHANGES.rst 2010-12-04 20:10:20 UTC (rev 118710)
@@ -19,6 +19,9 @@
Features Added
++++++++++++++
+- Moved subset id calculation in `OFS.OrderSupport.moveObjectsByDelta` to a
+ new helper method, patch by Tom Gross.
+
- Updated to Zope Toolkit 1.0.1.
- Use cProfile where possible for the
Modified: Zope/branches/2.13/src/OFS/OrderSupport.py
===================================================================
--- Zope/branches/2.13/src/OFS/OrderSupport.py 2010-12-04 20:07:09 UTC (rev 118709)
+++ Zope/branches/2.13/src/OFS/OrderSupport.py 2010-12-04 20:10:20 UTC (rev 118710)
@@ -134,12 +134,12 @@
suppress_events=False):
""" Move specified sub-objects by delta.
"""
- if type(ids) is str:
+ if isinstance(ids, basestring):
ids = (ids,)
min_position = 0
objects = list(self._objects)
- if subset_ids == None:
- subset_ids = [ obj['id'] for obj in objects ]
+ if subset_ids is None:
+ subset_ids = self.getIdsSubset(objects)
else:
subset_ids = list(subset_ids)
# unify moving direction
@@ -283,4 +283,12 @@
r.reverse()
return r
+ #
+ # Helper methods
+ #
+
+ def getIdsSubset(self, objects):
+ return [obj['id'] for obj in objects]
+
+
InitializeClass(OrderSupport)
More information about the Zope-Checkins
mailing list