[Zope3-dev] Re: Deleting utilities in site management doesn't work correct

jürgen Kartnaller j.kartnaller at cable.vol.at
Thu Oct 6 14:05:29 EDT 2005


Hi Tres,
I would really like to make a test for this but I have no idea how to start.

It took me 10 minutes to fix the problem but I think it will take me 10
hours to write the test.

If you can point me to a starting direction or just give me an example
test somewhere I will give it a try !

Jürgen

Tres Seaver wrote:
> jürgen Kartnaller wrote:
> 
>>>When more than one utility is selected for deleting in the site
>>>management view, only the first selected utility is deleted.
>>>
>>>The problem is that the content of regManager is changed inside the
>>>while iteratating over it.
>>>Here is the fix which works for me :
>>>If this is applicable, can please someone check it into the trunk ?
>>>The file is in zope.app.component.browser
>>>
>>>-------------------------------------------------------------------
>>>
>>>Index: tools.py
>>>===================================================================
>>>--- tools.py	(revision 38746)
>>>+++ tools.py	(working copy)
>>>@@ -192,7 +192,8 @@
>>>         tool = self.activeTool
>>>         regManager = self.context[tool.folder].registrationManager
>>>         names = self.request.form['selected']
>>>-        for reg in regManager.values():
>>>+        values=[v for v in regManager.values()]
>>>+        for reg in values:
>>>             if reg.provided.isOrExtends(tool.interface) and reg.name in
>>>names:
>>>                 component = reg.component
>>>                 reg.status = interfaces.registration.InactiveStatus
>>>
>>>-------------------------------------------------------------------
>>>
>>>Jürgen
>>>
> 
> 
> +1 for this fix, which should be applied to the 3.1 and 3.0 branches, as
> well (assuming that they have the bug).  A unit test which verified that
> multiple deletions actually worked would be ideal, of course.
> 
> 
> Tres.
> --
> ===================================================================
> Tres Seaver          +1 202-558-7113          tseaver at palladion.com
> Palladion Software   "Excellence by Design"    http://palladion.com



More information about the Zope3-dev mailing list