[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser - ServerControlView.py:1.1.2.2
Christian Theune
ct@gocept.com
Thu, 18 Apr 2002 16:03:44 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv31265/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser
Modified Files:
Tag: Zope-3x-branch
ServerControlView.py
Log Message:
- Removed the StubServerControl
- Added the ServerControl which implements a full server control (without the actual
shutdown/restarting capabilities, as those are factored out to hookable methods,
and we need to discuss how the shutdown will happen exactly - some asyncore rewriting
is planned AFAIK)
- updated unit tests
=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/ServerControl/Views/Browser/ServerControlView.py 1.1.2.1 => 1.1.2.2 ===
#
##############################################################################
-"""Provides a view for IServerControl
+__doc__ = """ Server Control View
-$Id$
-"""
+$Id$ """
from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
@@ -23,6 +22,7 @@
class ServerControlView(AttributePublisher):
+ # Boilerplate
def __init__(self, context):
self._context = context
@@ -33,9 +33,10 @@
return getUtility(self.getContext(), IServerControl) # XXX what are we going to do if this fails???
def action(self, REQUEST=None):
+ """Do the shutdown/restart!"""
if REQUEST.has_key('restart'):
- self.serverControl().restart()
+ return self.serverControl().restart() or "You restarted the server."
elif REQUEST.has_key('shutdown'):
- self.serverControl().shutdown()
-
+ return self.serverControl().shutdown() or "You shut down the server."
+
index = PageTemplateFile('server-control.pt')