Hi,

the way the manage_renameObjects() method was coded made it impossible 
to exchange two objects ids in one pass, e.g. rename Obj1 to Obj2 and 
Obj2 to Obj1.

The attached patch seems to correct this problem, however a better 
temporary id construction method is needed.

I've tried to submit it to the colector but I don't know if it succeeded.

hoping this will help

Jerome Alet
--- CopySupport.py.2.3.0-final  Sat Jan 27 10:04:42 2001
+++ CopySupport.py      Sat Jan 27 10:10:48 2001
@@ -280,9 +280,20 @@
         """Rename several sub-objects"""
         if len(ids) != len(new_ids):
             raise 'BadRequst','Please rename each listed object.'
+        conflicts = []    
         for i in range(len(ids)):
             if ids[i] != new_ids[i]:
+                if new_ids[i] not in ids :      # may a conflict occur ?
                 self.manage_renameObject(ids[i], new_ids[i], REQUEST)
+                else :        
+                        tempo = ".temporary_%i_" % i
+                        self.manage_renameObject(ids[i], tempo)
+                        conflicts.append((tempo, new_ids[i]))
+                        
+        # now we rename conflictuous objects                
+        for (old, new) in conflicts :               
+                self.manage_renameObject(old, new)
+                
         if REQUEST is not None:
             return self.manage_main(self, REQUEST, update_menu=1)
         return None

Reply via email to