[Zope3-checkins] CVS: Zope3/src/zope/app/applicationcontrol/browser
- server-control.pt:1.2 servercontrol.py:1.2
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Mar 23 10:52:42 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/applicationcontrol/browser
In directory cvs.zope.org:/tmp/cvs-serv2015/src/zope/app/applicationcontrol/browser
Modified Files:
server-control.pt servercontrol.py
Log Message:
Ripped out old shutdown hook code. Replaced code by better utility-based
model.
There are some to-do's missing, such as creating events, allowing graceful
shutdown and restart and so on. It's in TODOLATER.txt.
=== Zope3/src/zope/app/applicationcontrol/browser/server-control.pt 1.1 => 1.2 ===
--- Zope3/src/zope/app/applicationcontrol/browser/server-control.pt:1.1 Mon Mar 1 08:43:25 2004
+++ Zope3/src/zope/app/applicationcontrol/browser/server-control.pt Tue Mar 23 10:52:11 2004
@@ -6,10 +6,20 @@
<div metal:fill-slot="body">
<form name="servercontrol" action="ServerControl.html" method="post">
+ <span i18n:translate="">Shutdown time:</span>
+ <input type="text" name="time:int" size="5" value="0" />
+ <span i18n:translate="">seconds</span>
+
+ <p i18n:translate="">
+ If you specify a time of 0 seconds, then the server will do a hard
+ sutdown.
+ </p>
+
<input type="submit" name="restart" value="Restart server"
- i18n:attributes="value" /> <br />
+ i18n:attributes="value" />
+
<input type="submit" name="shutdown" value="Shutdown server"
- i18n:attributes="value" /> <br />
+ i18n:attributes="value" />
</form>
</div>
=== Zope3/src/zope/app/applicationcontrol/browser/servercontrol.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/applicationcontrol/browser/servercontrol.py:1.1 Mon Mar 1 08:43:25 2004
+++ Zope3/src/zope/app/applicationcontrol/browser/servercontrol.py Tue Mar 23 10:52:11 2004
@@ -11,29 +11,25 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-""" Server Control View
+"""Server Control View
$Id$
"""
+from zope.app import zapi
from zope.app.applicationcontrol.interfaces import IServerControl
-from zope.component import getUtility
from zope.app.i18n import ZopeMessageIDFactory as _
class ServerControlView:
def serverControl(self):
- # XXX Refactor alarm! This is *required*. We really
- # rely on it being there. If it was a utility,
- # we wouldn't care, if the ServerControl is gone,
- # but actually we do. Maybe this should be a service ...
- return getUtility(self.context, IServerControl)
+ return zapi.getUtility(self.context, IServerControl)
- def action(self):
+ def action(self, time=0):
"""Do the shutdown/restart!"""
if 'restart' in self.request:
- return (self.serverControl().restart()
+ return (self.serverControl().restart(time)
or _(u"You restarted the server."))
elif 'shutdown' in self.request:
- return (self.serverControl().shutdown()
+ return (self.serverControl().shutdown(time)
or _("You shut down the server."))
More information about the Zope3-Checkins
mailing list