[Zope3-checkins] SVN: Zope3/trunk/ Fixed issue #334: Failing RuntimeInfo tests

Dmitry Vasiliev dima at hlabs.spb.ru
Mon Mar 21 10:05:02 EST 2005


Log message for revision 29616:
  Fixed issue #334: Failing RuntimeInfo tests
  

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/app/applicationcontrol/runtimeinfo.py
  U   Zope3/trunk/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2005-03-21 15:02:44 UTC (rev 29615)
+++ Zope3/trunk/doc/CHANGES.txt	2005-03-21 15:05:02 UTC (rev 29616)
@@ -34,7 +34,7 @@
 
         Added a layer argument to the menu directives and made sure that all
         browser directives specify the layer for the menu directives.
-    
+
       - Implemented issue 292: Add factory to browser:resource directive 
 
       - Implemented issue 309: <schemadisplay> should support <widget>
@@ -521,6 +521,8 @@
 
     Bug Fixes
 
+      - Fixed issue #334: Failing RuntimeInfo tests
+
       - Fix: Pagelet directive was inoring the permission. Pagelets which
         not the right permission are not shwon if calling via the Tales 
         expression "pagelets:". If calling named pagelets directly via the
@@ -539,7 +541,7 @@
 
       - Fixed issue #360: MultiSelectWidget configured for ISet but creates
                           list
-                          
+
         The correct type of the collection field is now discovered and used.
 
       - Addressed issue #348: ZCML hides import errors 
@@ -633,7 +635,7 @@
 
       - If the content-type was text/*, HTTPResponse.write re-set the
         content-length header to the first chunk of data.
-      
+
       - Don't unconditionally add Content-Length header in
         HTTPResponse.getHeaders(). Do it only in output(), where the
         size of the data is known.
@@ -643,7 +645,7 @@
       Jim Fulton, Fred Drake, Philipp von Weitershausen, Stephan Richter,
       Gustavo Niemeyer, Daniel Nouri, Volker Bachschneider, Roger Ineichen,
       Shane Hathaway, Bjorn Tillenius, Garrett Smith, Marius Gedminas, Stuart
-      Bishop, Dominik Huber
+      Bishop, Dominik Huber, Dmitry Vasiliev
 
       Note: If you are not listed and contributed, please add yourself. This
       note will be deleted before the release.

Modified: Zope3/trunk/src/zope/app/applicationcontrol/runtimeinfo.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/runtimeinfo.py	2005-03-21 15:02:44 UTC (rev 29615)
+++ Zope3/trunk/src/zope/app/applicationcontrol/runtimeinfo.py	2005-03-21 15:05:02 UTC (rev 29616)
@@ -24,6 +24,11 @@
 except ImportError:
     locale = None
 
+try:
+    import platform
+except ImportError:
+    platform = None
+
 from zope.app.applicationcontrol.interfaces import \
      IRuntimeInfo, IApplicationControl, IZopeVersion
 from zope.component import getUtility, ComponentLookupError
@@ -71,12 +76,17 @@
 
     def getSystemPlatform(self):
         """See zope.app.applicationcontrol.interfaces.IRuntimeInfo"""
-        # FIXME: platform.platform()?
-        if hasattr(os, "uname"):
-            info = os.uname()
+        if platform is not None:
+            info = " ".join(platform.uname())
+        elif hasattr(os, "uname"):
+            info = " ".join(os.uname())
         else:
-            info = (sys.platform,)
-        return unicode(" ".join(info), self.getPreferredEncoding())
+            info = sys.platform
+        try:
+            return unicode(info, self.getPreferredEncoding())
+        except ValueError:
+            pass
+        return unicode(info, "latin1")
 
     def getCommandLine(self):
         """See zope.app.applicationcontrol.interfaces.IRuntimeInfo"""

Modified: Zope3/trunk/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py	2005-03-21 15:02:44 UTC (rev 29615)
+++ Zope3/trunk/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py	2005-03-21 15:05:02 UTC (rev 29616)
@@ -91,12 +91,7 @@
 
     def test_SystemPlatform(self):
         runtime_info = self._Test__new()
-        test_platform = (sys.platform,)
-        if hasattr(os, "uname"):
-            test_platform = os.uname()
-        enc = self._getPreferredEncoding()
-        self.assertEqual(runtime_info.getSystemPlatform(),
-                unicode(" ".join(test_platform), enc))
+        self.failUnless(runtime_info.getSystemPlatform())
 
     def test_CommandLine(self):
         runtime_info = self._Test__new()



More information about the Zope3-Checkins mailing list