Author: jmorliaguet
Date: Sat Jun 17 21:20:22 2006
New Revision: 3442

Modified:
   cpsskins/branches/paris-sprint-2006/browser/tree/views.py

Log:

- simpler code, using the API



Modified: cpsskins/branches/paris-sprint-2006/browser/tree/views.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/browser/tree/views.py   (original)
+++ cpsskins/branches/paris-sprint-2006/browser/tree/views.py   Sat Jun 17 
21:20:22 2006
@@ -96,15 +96,18 @@
     def duplicate(self, content):
         request = self.request
         container = self.context
+
         # save the element's order
-        order = list(container.keys())
-        content_order = order.index(getName(content))
+        ordering = getMultiAdapter((container, request), INodeOrdering)
+        order = ordering.getOrder(content)
+
         # duplicate the element
         copier = IObjectCopier(content)
         copied_name = copier.copyTo(container)
         copied = container[copied_name]
+
         # move the copied element just below the original element
-        ordering = getMultiAdapter((container, request), INodeOrdering)
-        ordering.setOrder(copied, int(content_order)+1)
+        ordering.setOrder(copied, int(order)+1)
+
         return copied.identifier
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to