[Zope-Checkins] SVN: Zope/trunk/ Forward ported c118710 from 2.13 branch

Hanno Schlichting hannosch at hannosch.eu
Sat Dec 4 15:12:49 EST 2010


Log message for revision 118712:
  Forward ported c118710 from 2.13 branch
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/OFS/OrderSupport.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst	2010-12-04 20:12:10 UTC (rev 118711)
+++ Zope/trunk/doc/CHANGES.rst	2010-12-04 20:12:49 UTC (rev 118712)
@@ -16,14 +16,16 @@
   since Python 2.5.  This breaks Python 2.4 compatibility when the
   publisher-profile-file configuration option is set.
 
-- Use cProfile where possible for the
-  Control_Panel/DebugInfo/manage_profile ZMI view.
-
 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
+  Control_Panel/DebugInfo/manage_profile ZMI view.
 
 Restructuring
 +++++++++++++

Modified: Zope/trunk/src/OFS/OrderSupport.py
===================================================================
--- Zope/trunk/src/OFS/OrderSupport.py	2010-12-04 20:12:10 UTC (rev 118711)
+++ Zope/trunk/src/OFS/OrderSupport.py	2010-12-04 20:12:49 UTC (rev 118712)
@@ -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