[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container/Views/Browser - Adding.py:1.12 Contents.py:1.10 add.pt:1.6

Jim Fulton jim@zope.com
Sat, 30 Nov 2002 13:34:35 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv11554/lib/python/Zope/App/OFS/Container/Views/Browser

Modified Files:
	Adding.py Contents.py add.pt 
Log Message:

Added marker interfaces to indicate containers that will:

- Pick item names if no item is given, and containers that

- Always pick their own item names.

Updates views to take advantage of this information.



=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adding.py 1.11 => 1.12 ===
--- Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adding.py:1.11	Mon Nov 18 18:52:59 2002
+++ Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adding.py	Sat Nov 30 13:34:34 2002
@@ -17,6 +17,7 @@
 """
 
 from Zope.App.OFS.Container.IAdding import IAdding
+from Zope.App.OFS.Container.IContainer import IContainerNamesContainer
 from Zope.Publisher.Browser.BrowserView import BrowserView
 from Zope.Publisher.IPublishTraverse import IPublishTraverse
 from Zope.ComponentArchitecture \
@@ -101,7 +102,7 @@
         menu_service = getService(self.context, "BrowserMenu")
         return menu_service.getMenu(self.menu_id, self, self.request)
 
-    def action(self, type_name, id):
+    def action(self, type_name, id=''):
         if queryView(self, type_name, self.request) is not None:
             url = "%s=%s" % (type_name, id)
             self.request.response.redirect(url)
@@ -118,5 +119,6 @@
         self.add(content)
         self.request.response.redirect(self.nextURL())
 
-
+    def namesAccepted(self):
+        return not IContainerNamesContainer.isImplementedBy(self.context)
 


=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Contents.py 1.9 => 1.10 ===
--- Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Contents.py:1.9	Mon Nov 18 18:52:59 2002
+++ Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Contents.py	Sat Nov 30 13:34:34 2002
@@ -61,9 +61,8 @@
 
     def removeObjects(self, ids):
         """Remove objects specified in a list of object ids"""
-        container = self.context
+        container = getAdapter(self.context, IZopeContainer)
         for id in ids:
-            container = getAdapter(container, IZopeContainer)
             container.__delitem__(id)
 
         self.request.response.redirect('@@contents.html')


=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/add.pt 1.5 => 1.6 ===
--- Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/add.pt:1.5	Tue Oct 22 15:34:59 2002
+++ Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/add.pt	Sat Nov 30 13:34:34 2002
@@ -85,7 +85,8 @@
 
   <tr>
     <td><br/></td>
-    <td><input type="text" name="id" />
+    <td>
+        <input type="text" name="id" tal:condition="view/namesAccepted" />
         <input type="submit" value=" Add " />
     </td>
   </tr>