[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container - adding.py:1.4

Jim Fulton jim@zope.com
Tue, 31 Dec 2002 15:11:02 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/container
In directory cvs.zope.org:/tmp/cvs-serv1464

Modified Files:
	adding.py 
Log Message:
Added logic to remove leading @@s from names. This is necessary due to
the ways menus can get generated, and due to the fact that menus drive
the adding process.


=== Zope3/src/zope/app/browser/container/adding.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/container/adding.py:1.3	Mon Dec 30 09:02:51 2002
+++ Zope3/src/zope/app/browser/container/adding.py	Tue Dec 31 15:11:01 2002
@@ -59,9 +59,16 @@
             view_name, content_name = name.split("=", 1)
             self.contentName = content_name
 
+            if view_name.startswith('@@'):
+                view_name = view_name[2:]
             return getView(self, view_name, request)
 
-        view = queryView(self, name, request)
+        if name.startswith('@@'):
+            view_name = name[2:]
+        else:
+            view_name = name
+            
+        view = queryView(self, view_name, request)
         if view is not None:
             return view
 
@@ -70,6 +77,7 @@
             return ContextSuper(Adding, self).publishTraverse(request, name)
 
         return factory
+
     publishTraverse = ContextMethod(publishTraverse)
 
     #
@@ -86,6 +94,9 @@
     addingInfo = ContextMethod(addingInfo)
 
     def action(self, type_name, id=''):
+        if type_name.startswith('@@'):
+            type_name = type_name[2:]
+        
         if queryView(self, type_name, self.request) is not None:
             url = "%s=%s" % (type_name, id)
             self.request.response.redirect(url)