[Zope-CVS] CVS: Packages/zasync - manager.py:1.2
Gary Poster
gary at zope.com
Thu Oct 14 12:35:05 EDT 2004
Update of /cvs-repository/Packages/zasync
In directory cvs.zope.org:/tmp/cvs-serv22088
Modified Files:
manager.py
Log Message:
Add an overview tab that includes information on the plugins and allows you to ping the zasync client to see if it is active.
=== Packages/zasync/manager.py 1.1.1.1 => 1.2 ===
--- Packages/zasync/manager.py:1.1.1.1 Sun Oct 10 19:37:06 2004
+++ Packages/zasync/manager.py Thu Oct 14 12:35:04 2004
@@ -314,6 +314,7 @@
security = ClassSecurityInfo()
manage_options = (
+ ({'label':'Overview', 'action':'manage_overview',},) +
PropertyManager.manage_options
+ SimpleItem.manage_options)
@@ -330,7 +331,7 @@
rotation_period = 60*60*24 # a day
poll_interval = 5
__plugins = ()
- _next_rotate = None
+ _next_rotate = _last_ping = _last_pong = None
# keep webdav interface off deferreds and tool
__implements__ = (interfaces.IZasyncAsynchronousCallManager,)
@@ -349,7 +350,37 @@
# long term cache
self._resolved = bforests.OOBForest()
self._next_rotate = None
+ self._last_ping = None
+ self._last_pong = None
+
+
+ security.declareProtected(permissions.ViewManagementScreens,
+ 'manage_overview')
+ manage_overview = PageTemplateFile(
+ 'www/controlAsynchronousCallManagerForm.zpt', globals(),
+ __name__='manage_overview')
+
+ security.declareProtected(permissions.ViewManagementScreens,
+ 'ping')
+ def ping(self, REQUEST=None):
+ """make a ping request to the zasync client to see if it replies
+ in the heartbeat method."""
+ self._last_ping = datetime.datetime.now()
+ self._last_pong = None
+ if REQUEST is not None:
+ REQUEST.RESPONSE.redirect(
+ '%s/manage_overview' % self.absolute_url())
+ security.declareProtected(permissions.ViewManagementScreens,
+ 'getLastPing')
+ def getLastPing(self):
+ return self._last_ping
+
+ security.declareProtected(permissions.ViewManagementScreens,
+ 'getLastPong')
+ def getLastPong(self):
+ return self._last_pong
+
# property code copied from CMFCore/utils.py SimpleItemWithProperties >>>
security.declarePrivate('manage_addProperty')
security.declarePrivate('manage_delProperties')
@@ -500,15 +531,14 @@
datetime.timedelta(seconds=self.rotation_period))
else:
self._next_rotate = None
- # fire off event if desired ...
+ if self._last_ping is not None and self._last_pong is None:
+ self._last_pong = now
+ # maybe optionally fire off clock tick event? TBD
InitializeClass(AsynchronousCallManager)
-_www = os.path.join(os.path.dirname(__file__), "www")
-
constructAsynchronousCallManagerForm = PageTemplateFile(
- 'constructAsynchronousCallManagerForm.zpt', _www)
-constructAsynchronousCallManagerForm.__name__ = (
- "constructAsynchronousCallManagerForm")
+ 'www/constructAsynchronousCallManagerForm.zpt', globals(),
+ __name__='manage_addSchedulerForm')
def constructAsynchronousCallManager(
dispatcher, id="asynchronous_call_manager",
More information about the Zope-CVS
mailing list