[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser - ServerControlView.py:1.1.2.5 browser.zcml:1.1.2.4 server-control.pt:1.1.2.2

Jim Fulton jim@zope.com
Fri, 7 Jun 2002 10:41:32 -0400


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

Modified Files:
      Tag: Zope-3x-branch
	ServerControlView.py browser.zcml server-control.pt 
Log Message:
Merging in Zope3InWonderland-branch, which implemented the following
proposals (see
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/OldProposals): 
- RenameAllowToRequire

- GroupClassRelatedDirectivesInClassDirective

- ViewInterfaceAndSimplification

- ConsistentUseOfSpacesAsDelimitersInZCMLAttributes

- TwoArgumentViewConstructors

- ImplementsInZCML

- SimpleViewCreationInZCML

- RemoveGetView

- ReplaceProtectWithAllow

- ViewMethodsAsViews

- MergeProtectionAndComponentDefinitions

There were also various security fixes resulting of better integration
of security with components.


=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser/ServerControlView.py 1.1.2.4 => 1.1.2.5 ===
 $Id$ """
 
-from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
+from Zope.Publisher.Browser.BrowserView import BrowserView
 from Zope.App.PageTemplate import ViewPageTemplateFile
 from Zope.App.OFS.ApplicationControl.ServerControl.IServerControl \
      import IServerControl
 from Zope.ComponentArchitecture import getUtility
 
-class ServerControlView(AttributePublisher):
-
-    # Boilerplate
-    def __init__(self, context):
-        self._context = context
-
-    def getContext(self):
-        return self._context
+class ServerControlView(BrowserView):
     
     def serverControl(self):
-        return getUtility(self.getContext(), IServerControl)
+        return getUtility(self.context, IServerControl)
           # XXX what are we going to do if this fails???
     
     def action(self, REQUEST=None):
@@ -43,3 +36,4 @@
             "You shut down the server."
 
     index = ViewPageTemplateFile('server-control.pt')
+


=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser/browser.zcml 1.1.2.3 => 1.1.2.4 ===
 
   <!-- ServerControl View Directives -->
-  <browser:view name="servercontrol"
-    for="Zope.App.OFS.ApplicationControl.IApplicationControl."
-    factory=".ServerControlView." />
-
-  <application-control:registerView name="servercontrol"
-    title="Server control" />
-
-  <security:protectClass 
-    class=".ServerControlView."
-    permission_id="Zope.ManageApplication"
-    names="index, action" />
+  <browser:view
+      for="Zope.App.OFS.ApplicationControl.IApplicationControl."
+      permission="Zope.ManageApplication"
+      factory=".ServerControlView.">
+    
+    <browser:page name="ServerControlForm.html" attribute="index" />
+    <browser:page name="ServerControl.html"     attribute="action" />
+  </browser:view>
+    
 
+  <application-control:registerView
+      name="ServerControlForm.html"
+      title="Server control" />
     
 </zopeConfigure>


=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser/server-control.pt 1.1.2.1 => 1.1.2.2 ===
 <div metal:fill-slot="body">
 
-  <!-- XXX /ApplicationController;etc/servercontrol;view/restart is a workaround for the unavailable
-       absolute_url function. -->
-
- <form name="servercontrol" tal:attributes="action string:/ApplicationController;;etc/servercontrol;;view/action" method="post">
+ <form name="servercontrol" action="ServerControl.html" method="post">
   <input type="submit" name="restart" value="Restart server" /> <br />
   <input type="submit" name="shutdown" value="Shutdown server" /> <br />
  </form>