[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Browser - EditConfiguration.py:1.4
Guido van Rossum
guido@python.org
Fri, 6 Dec 2002 09:16:33 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Browser
In directory cvs.zope.org:/tmp/cvs-serv31975
Modified Files:
EditConfiguration.py
Log Message:
There was a LocalNameError here: k was not set when the request didn't
have 'keys'. It's a bit tricky to fix: when k is used but not set,
that really is a user error (these operations require at least one
checked box). The quickest way to fix this is to repeat the error
test (empty k) foir each such operation. When the error occurs, we
return a string for the view to deal with.
=== Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Browser/EditConfiguration.py 1.3 => 1.4 ===
--- Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Browser/EditConfiguration.py:1.3 Sun Dec 1 05:28:22 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Browser/EditConfiguration.py Fri Dec 6 09:16:31 2002
@@ -35,20 +35,31 @@
"""
+ if 'add_submit' in self.request:
+ self.request.response.redirect('+')
+ return ''
+
if 'keys' in self.request:
k = self.request['keys']
+ else:
+ k = []
- if 'add_submit' in self.request:
- self.request.response.redirect('+')
- elif 'remove_submit' in self.request:
+ msg = 'You must select at least one item to use this action'
+
+ if 'remove_submit' in self.request:
+ if not k: return msg
self.remove_objects(k)
elif 'top_submit' in self.request:
+ if not k: return msg
self.context.moveTop(k)
elif 'bottom_submit' in self.request:
+ if not k: return msg
self.context.moveBottom(k)
elif 'up_submit' in self.request:
+ if not k: return msg
self.context.moveUp(k)
elif 'down_submit' in self.request:
+ if not k: return msg
self.context.moveDown(k)
return ''