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

Tres Seaver tseaver at palladion.com
Wed Oct 5 20:17:20 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDRG0Q+gerLs4ltQ4RAiIvAJ0XifbHSonFIHbbGH4rGY/j6COZOgCeMrVM
Vd+MTcRa/sLNIh87EBB0nR8=
=TnZf
-----END PGP SIGNATURE-----



More information about the Zope3-dev mailing list