Commit 764bd81e authored by Hanno Schlichting's avatar Hanno Schlichting

Moved subset id calculation in `OFS.OrderSupport.moveObjectsByDelta` to a new...

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 :)
parent 463ebf7f
......@@ -19,6 +19,9 @@ Bugs Fixed
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
......
......@@ -134,12 +134,12 @@ class OrderSupport(object):
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 @@ class OrderSupport(object):
r.reverse()
return r
#
# Helper methods
#
def getIdsSubset(self, objects):
return [obj['id'] for obj in objects]
InitializeClass(OrderSupport)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment