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 ...@@ -19,6 +19,9 @@ Bugs Fixed
Features Added 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. - Updated to Zope Toolkit 1.0.1.
- Use cProfile where possible for the - Use cProfile where possible for the
......
...@@ -134,12 +134,12 @@ class OrderSupport(object): ...@@ -134,12 +134,12 @@ class OrderSupport(object):
suppress_events=False): suppress_events=False):
""" Move specified sub-objects by delta. """ Move specified sub-objects by delta.
""" """
if type(ids) is str: if isinstance(ids, basestring):
ids = (ids,) ids = (ids,)
min_position = 0 min_position = 0
objects = list(self._objects) objects = list(self._objects)
if subset_ids == None: if subset_ids is None:
subset_ids = [ obj['id'] for obj in objects ] subset_ids = self.getIdsSubset(objects)
else: else:
subset_ids = list(subset_ids) subset_ids = list(subset_ids)
# unify moving direction # unify moving direction
...@@ -283,4 +283,12 @@ class OrderSupport(object): ...@@ -283,4 +283,12 @@ class OrderSupport(object):
r.reverse() r.reverse()
return r return r
#
# Helper methods
#
def getIdsSubset(self, objects):
return [obj['id'] for obj in objects]
InitializeClass(OrderSupport) 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