[Zope3-checkins] CVS: Zope3/src/zope/app/applicationcontrol/browser - runtimeinfo.py:1.3

Dmitry Vasiliev dima at hlabs.spb.ru
Tue Mar 23 08:35:39 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/applicationcontrol/browser
In directory cvs.zope.org:/tmp/cvs-serv5236/browser

Modified Files:
	runtimeinfo.py 
Log Message:
RuntimeInfo changes:
- new method: getPreferredEncoding()
- getSystemPlatform(), getPythonVersion() now returns an unicode strings encoded
  with the preferred system encoding


=== Zope3/src/zope/app/applicationcontrol/browser/runtimeinfo.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/applicationcontrol/browser/runtimeinfo.py:1.2	Sat Mar  6 11:50:12 2004
+++ Zope3/src/zope/app/applicationcontrol/browser/runtimeinfo.py	Tue Mar 23 08:35:07 2004
@@ -30,23 +30,15 @@
             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['SystemPlatform'] = runtime_info.getSystemPlatform()
+            formatted['CommandLine'] = 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
+            uptime = long(runtime_info.getUptime())
+            minutes, seconds = divmod(uptime, 60)
+            hours, minutes = divmod(minutes, 60)
+            days, hours = divmod(hours, 24)
 
             uptime = _('${days} day(s) ${hours}:${minutes}:${seconds}')
             uptime.mapping = {'days': '%d' %days,
@@ -59,14 +51,15 @@
         except TypeError:
             # We avoid having errors in the ApplicationController,
             # because all those things need to stay accessible.
-            formatted['ZopeVersion'] = "N/A"
-            formatted['PythonVersion'] = "N/A"
-            formatted['PythonPath'] = "N/A"
-            formatted['SystemPlatform'] = "N/A"
-            formatted['CommandLine'] = "N/A"
-            formatted['ProcessId'] = "N/A"
-            formatted['Uptime'] = "N/A"
-            formatted['Hint'] = "Could not retrieve runtime information."
+            na = _("n/a")
+            formatted['ZopeVersion'] = na
+            formatted['PythonVersion'] = na
+            formatted['PythonPath'] = (na,)
+            formatted['SystemPlatform'] = na
+            formatted['CommandLine'] = na
+            formatted['ProcessId'] = na
+            formatted['Uptime'] = na
+            formatted['Hint'] = _("Could not retrieve runtime information.")
 
         return formatted
 




More information about the Zope3-Checkins mailing list