Author: jmorliaguet
Date: Sat Jun 17 18:18:02 2006
New Revision: 3437

Modified:
   cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py

Log:

- simplified the API: the destination element must be a container



Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py      
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py      Sat Jun 
17 18:18:02 2006
@@ -380,7 +380,7 @@
         order = self.getElementOrder(id)
         self.setElementOrder(id, int(order)+1)
 
-    def moveElement(self, src_id, dest_id, order):
+    def moveElement(self, src_id, dest_id, order=0):
         """Move an element to another destination element.
         return the id of the moved element.
         """
@@ -388,16 +388,11 @@
         src_element = self.tmutil.getElementById(src_id)
         src_container = getParent(src_element)
         dest_element = self.tmutil.getElementById(dest_id)
-        if IInnerNode.providedBy(dest_element):
-            dest_container = dest_element
-        else:
-            dest_container = getParent(dest_element)
-            order = self.getElementOrder(dest_id)
-            if dest_container == src_container:
-                order = order -1
+        if not IInnerNode.providedBy(dest_element):
+            raise TypeError("The destination element is not a container")
 
         # move the element to the destination container
-        moving = getMultiAdapter((dest_container, request), INodeMoving)
+        moving = getMultiAdapter((dest_element, request), INodeMoving)
         moved = moving.move(src_element)
 
         # move the element to the specified order
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to