[Erp5-report] r45829 vincent - /erp5/trunk/products/ERP5Type/CopySupport.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed May 4 15:10:16 CEST 2011


Author: vincent
Date: Wed May  4 15:10:16 2011
New Revision: 45829

URL: http://svn.erp5.org?rev=45829&view=rev
Log:
Reduce brokenness.

Putting an uid in "ids" list is plain broken, and a no-op here -> removed.
Use pop() instead of __getitem__ + __delitem__ .
Don't access possibly empty (and unrelated !) "ids" list in error message.

Modified:
    erp5/trunk/products/ERP5Type/CopySupport.py

Modified: erp5/trunk/products/ERP5Type/CopySupport.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/CopySupport.py?rev=45829&r1=45828&r2=45829&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/CopySupport.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/CopySupport.py [utf8] Wed May  4 15:10:16 2011
@@ -217,22 +217,19 @@ class CopyContainer:
       if len(ids) > 0:
         # Use default method
         return ObjectManager.manage_delObjects(self, ids, REQUEST)
-      if isinstance(uids, (str, int)):
-        ids=[uids]
       if not uids:
           return MessageDialog(title='No items specified',
                  message='No items were specified!',
                  action ='./manage_main',)
       while uids:
-          uid=uids[-1]
+          uid = uids.pop()
           ob=self.getPortalObject().portal_catalog.getObject(uid)
           container = ob.aq_inner.aq_parent
           id = ob.id
           v=container._getOb(id, self)
           if v is self:
-              raise BadRequest('%s does not exist' % ids[-1])
+              raise BadRequest('%s does not exist' % id)
           container._delObject(id)
-          del uids[-1]
       if REQUEST is not None:
               return self.manage_main(self, REQUEST, update_menu=1)
 



More information about the Erp5-report mailing list