[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/service - __init__.py:1.19

Jim Fulton jim at zope.com
Wed Feb 11 00:52:59 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/browser/services/service
In directory cvs.zope.org:/tmp/cvs-serv32199/src/zope/app/browser/services/service

Modified Files:
	__init__.py 
Log Message:
The action method needs to be able to handle ids not being passed.

Changed to use the standard chooser to generate names based
on the class of the thing added.


=== Zope3/src/zope/app/browser/services/service/__init__.py 1.18 => 1.19 ===
--- Zope3/src/zope/app/browser/services/service/__init__.py:1.18	Mon Feb  9 00:45:33 2004
+++ Zope3/src/zope/app/browser/services/service/__init__.py	Wed Feb 11 00:52:58 2004
@@ -54,10 +54,9 @@
 
         return super(ComponentAdding, self).nextURL()
 
-    def action(self, type_name, id):
+    def action(self, type_name, id=''):
         # For special case of that we want to redirect to another adding view
         # (usually another menu such as AddService)
-        import re
         if type_name.startswith("../"):
             # Special case
             url = type_name
@@ -65,24 +64,6 @@
                 url += "?id=" + id
             self.request.response.redirect(url)
             return
-
-        if not id:
-            # Generate an id from the type name
-            id = type_name
-            l = id.rfind('.')
-            if l >= 0:
-                id = id[l+1:]
-                # Add menus generate meaningless factory names.
-                # Skip them.
-                if re.match('^f[0-9]*$', id):
-                    id = type_name[:l]
-                    l = id.rfind('.')
-                    if l >= 0:
-                        id = id[l+1:]
-                
-            
-        chooser = zapi.getAdapter(self.context, INameChooser)
-        id = chooser.chooseName(id, None)
 
         # Call the superclass action() method.
         # As a side effect, self.added_object is set by add() above.




More information about the Zope3-Checkins mailing list