[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/Browser - configure.zcml:1.3.4.3 view.py:1.1.2.2 add_view_config.pt:NONE

Jim Fulton jim@zope.com
Thu, 12 Dec 2002 14:25:46 -0500


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

Modified Files:
      Tag: AdapterAndView-branch
	configure.zcml view.py 
Removed Files:
      Tag: AdapterAndView-branch
	add_view_config.pt 
Log Message:
Modified the view and page configuration add code to use the new
generic add views from the forms package. This was largely to test the
new generic add views. We were able to eliminate a page template and
two classes.


=== Zope3/lib/python/Zope/App/OFS/Services/Browser/configure.zcml 1.3.4.2 => 1.3.4.3 ===
--- Zope3/lib/python/Zope/App/OFS/Services/Browser/configure.zcml:1.3.4.2	Thu Dec 12 10:19:54 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Browser/configure.zcml	Thu Dec 12 14:25:46 2002
@@ -126,17 +126,17 @@
      permission="Zope.ManageServices" 
      />  
 
-<view
-     for = "Zope.App.OFS.Container.IAdding."
-     name="ViewConfiguration"
-     permission="Zope.ManageServices" 
-     factory=".Browser.view.ViewConfigurationAdd"
-     >
-  <page
-      name="index.html"
-      template="Browser/add_adapter_config.pt"
+<form:add
+      schema = ".interfaces.IViewConfiguration"
+      name= "ViewConfiguration"
+      content_factory = ".view.ViewConfiguration"
+      keyword_arguments = "forInterface presentationType factoryName viewName"
+      set_before_add = "layer"
+      label = "Configure a view" 
+      permission="Zope.ManageServices" 
+      fields="forInterface viewName presentationType
+              factoryName layer title status description"
       />
-</view>
 
 <menuItem
       for="Zope.App.OFS.Container.IAdding."
@@ -191,17 +191,18 @@
      permission="Zope.ManageServices" 
      />  
 
-<view
-     for = "Zope.App.OFS.Container.IAdding."
-     name="PageConfiguration"
-     permission="Zope.ManageServices" 
-     factory=".Browser.view.PageConfigurationAdd"
-     >
-  <page
-      name="index.html"
-      template="Browser/add_adapter_config.pt"
+<form:add
+      schema = ".interfaces.IPageConfiguration"
+      name= "PageConfiguration"
+      content_factory = ".view.PageConfiguration"
+      keyword_arguments = "forInterface presentationType factoryName
+                           viewName"
+      set_before_add = "template layer"
+      label = "Configure a view page" 
+      permission="Zope.ManageServices" 
+      fields="forInterface viewName presentationType
+              template factoryName layer title status description"
       />
-</view>
 
 <menuItem
       for="Zope.App.OFS.Container.IAdding."


=== Zope3/lib/python/Zope/App/OFS/Services/Browser/view.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/lib/python/Zope/App/OFS/Services/Browser/view.py:1.1.2.1	Thu Dec 12 10:19:54 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Browser/view.py	Thu Dec 12 14:25:46 2002
@@ -108,56 +108,3 @@
                  })
 
         return result
-
-
-class ViewConfigurationAdd(BrowserView):
-
-    def __init__(self, *args):
-        super(ViewConfigurationAdd, self).__init__(*args)
-        setUpWidgets(self, IViewConfiguration)
-
-    def refresh(self):
-        if "FINISH" in self.request:
-            data = getWidgetsData(self, IViewConfigurationInfo)
-            configuration = ViewConfiguration(**data)
-            publish(self.context.context, ObjectCreatedEvent(configuration))
-            configuration = self.context.add(configuration)
-            getWidgetsDataForContent(self, IConfiguration, configuration)
-            self.request.response.redirect(self.context.nextURL())
-            return False
-
-        return True
-
-    def getWidgets(self):
-        return ([getattr(self, name)
-                 for name in fieldNames(IViewConfigurationInfo)]
-                +
-                [getattr(self, name)
-                 for name in fieldNames(IConfiguration)]
-                )
-
-class PageConfigurationAdd(BrowserView):
-
-    def __init__(self, *args):
-        super(PageConfigurationAdd, self).__init__(*args)
-        setUpWidgets(self, IPageConfiguration)
-
-    def refresh(self):
-        if "FINISH" in self.request:
-            data = getWidgetsData(self, IPageConfigurationInfo)
-            configuration = PageConfiguration(**data)
-            publish(self.context.context, ObjectCreatedEvent(configuration))
-            configuration = self.context.add(configuration)
-            getWidgetsDataForContent(self, IConfiguration, configuration)
-            self.request.response.redirect(self.context.nextURL())
-            return False
-
-        return True
-
-    def getWidgets(self):
-        return ([getattr(self, name)
-                 for name in fieldNames(IPageConfigurationInfo)]
-                +
-                [getattr(self, name)
-                 for name in fieldNames(IConfiguration)]
-                )

=== Removed File Zope3/lib/python/Zope/App/OFS/Services/Browser/add_view_config.pt ===