[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container - adding.py:1.7
Jim Fulton
jim@zope.com
Fri, 7 Mar 2003 07:10:24 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/container
In directory cvs.zope.org:/tmp/cvs-serv6845
Modified Files:
adding.py
Log Message:
Changed to raise a user error when the user neglected to pick a
type. This is an improvement over the previous behavior. It would be
better to redisplay the form with the message.
=== Zope3/src/zope/app/browser/container/adding.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/browser/container/adding.py:1.6 Tue Mar 4 11:28:48 2003
+++ Zope3/src/zope/app/browser/container/adding.py Fri Mar 7 07:10:22 2003
@@ -17,6 +17,8 @@
"""
__metaclass__ = type
+from zope.app.interfaces.exceptions import UserError
+
from zope.app.interfaces.container import IAdding
from zope.app.interfaces.container import IContainerNamesContainer
from zope.app.interfaces.container import IZopeContainer
@@ -101,7 +103,10 @@
return result
addingInfo = ContextMethod(addingInfo)
- def action(self, type_name, id=''):
+ def action(self, type_name='', id=''):
+ if not type_name:
+ raise UserError("You must select the type of object to add.")
+
if type_name.startswith('@@'):
type_name = type_name[2:]