[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/ApplicationControl/Views/Browser - RuntimeInfoView.py:1.2 __init__.py:1.2 browser.zcml:1.2 index.pt:1.2 runtimeinfo.pt:1.2
Jim Fulton
jim@zope.com
Mon, 10 Jun 2002 19:28:25 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/ApplicationControl/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv17445/lib/python/Zope/App/OFS/ApplicationControl/Views/Browser
Added Files:
RuntimeInfoView.py __init__.py browser.zcml index.pt
runtimeinfo.pt
Log Message:
Merged Zope-3x-branch into newly forked Zope3 CVS Tree.
=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/Views/Browser/RuntimeInfoView.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Define runtime information view component for Application Control
+
+$Id$
+"""
+
+from Zope.Publisher.Browser.BrowserView import BrowserView
+from Zope.App.OFS.ApplicationControl.IRuntimeInfo import IRuntimeInfo
+from Zope.App.PageTemplate import ViewPageTemplateFile
+from Zope.ComponentArchitecture import getAdapter
+
+class RuntimeInfoView(BrowserView):
+
+ def runtimeInfo(self):
+ # XXX what are we going to do if this fails???
+ runtime_info = getAdapter(self.context, IRuntimeInfo)
+ formatted = {} # contains formatted runtime information
+ formatted['ZopeVersion'] = runtime_info.getZopeVersion()
+ formatted['PythonVersion'] = runtime_info.getPythonVersion()
+ formatted['PythonPath'] = runtime_info.getPythonPath()
+ formatted['SystemPlatform'] = " ".join(runtime_info.getSystemPlatform())
+ formatted['CommandLine'] = " ".join(runtime_info.getCommandLine())
+ formatted['ProcessId'] = runtime_info.getProcessId()
+
+ # make a unix "uptime" uptime format
+ uptime = runtime_info.getUptime()
+ days = int(uptime / (60*60*24))
+ uptime = uptime - days * (60*60*24)
+
+ hours = int(uptime / (60*60))
+ uptime = uptime - hours * (60*60)
+
+ minutes = int(uptime / 60)
+ uptime = uptime - minutes * 60
+
+ seconds = uptime
+ formatted['Uptime'] = "%s%02d:%02d:%02d" % (
+ ((days or "") and "%d days, " % days), hours, minutes, seconds)
+
+ return formatted
+
+ index = ViewPageTemplateFile('runtimeinfo.pt')
=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/Views/Browser/__init__.py 1.1 => 1.2 ===
=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/Views/Browser/browser.zcml 1.1 => 1.2 ===
+ xmlns='http://namespaces.zope.org/zope'
+ xmlns:security='http://namespaces.zope.org/security'
+ xmlns:browser='http://namespaces.zope.org/browser'
+ xmlns:application-control='http://namespaces.zope.org/application-control'
+>
+
+ <!-- ApplicationControl View Directives -->
+ <browser:defaultView
+ name="index.html"
+ for="Zope.App.OFS.ApplicationControl.IApplicationControl."
+ permission="Zope.ManageApplication"
+ template="index.pt"
+ />
+
+ <!-- RuntimeInfo View Directives -->
+ <browser:view
+ for="Zope.App.OFS.ApplicationControl.IApplicationControl."
+ factory=".RuntimeInfoView."
+ permission="Zope.ManageApplication" >
+
+ <browser:page name="RuntimeInfo.html" attribute="index" />
+ </browser:view>
+
+
+ <!-- Hint:
+ also register the 'runtimeinfo' view as ApplicationControl plugin -->
+ <application-control:registerView
+ name="RuntimeInfo.html"
+ title="Runtime Information" />
+
+</zopeConfigure>
=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/Views/Browser/index.pt 1.1 => 1.2 ===
+<head>
+<title>Zope Application Controller</title>
+</head>
+<body>
+<div metal:fill-slot="body">
+
+<ul>
+ <!-- XXX /ApplicationController;etc/${info/name} is a workaround for the unavailable
+ absolute_url function. -->
+ <li tal:repeat="info context/getListOfViews"><a
+ tal:attributes="href
+ string:/++etc++ApplicationController/@@${info/name}"
+ tal:content="info/title"
+ >Foo Title</a></li>
+</ul>
+
+</div>
+</body>
+</html>
=== Zope3/lib/python/Zope/App/OFS/ApplicationControl/Views/Browser/runtimeinfo.pt 1.1 => 1.2 ===
+<head>
+<title>Zope Runtime Information</title>
+</head>
+<body>
+<div metal:fill-slot="body">
+
+<ul tal:define="runtime_info view/runtimeInfo">
+ <li>Zope version: <span tal:replace="runtime_info/ZopeVersion" />
+ <li>Python version: <span tal:replace="runtime_info/PythonVersion" />
+ <li>System platform: <span tal:replace="runtime_info/SystemPlatform" />
+ <li>Command line: <span tal:replace="runtime_info/CommandLine" />
+ <li>Process id: <span tal:replace="runtime_info/ProcessId" />
+ <li>Uptime: <span tal:replace="runtime_info/Uptime" />
+ <li>Python path:</li>
+ <ul>
+ <li tal:repeat="path runtime_info/PythonPath" tal:content="path">path</li>
+ </ul>
+</ul>
+
+</div>
+</body>
+</html>