[Zope3-checkins] CVS: Zope3/src/zope/app/applicationcontrol -
interfaces.py:1.5 runtimeinfo.py:1.7
Dmitry Vasiliev
dima at hlabs.spb.ru
Wed Mar 24 06:13:44 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/applicationcontrol
In directory cvs.zope.org:/tmp/cvs-serv22226
Modified Files:
interfaces.py runtimeinfo.py
Log Message:
RuntimeInfo changes:
- new method: getFileSystemEncoding()
- getPythonPath() now returns unicode strings
=== Zope3/src/zope/app/applicationcontrol/interfaces.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/applicationcontrol/interfaces.py:1.4 Tue Mar 23 10:52:10 2004
+++ Zope3/src/zope/app/applicationcontrol/interfaces.py Wed Mar 24 06:13:13 2004
@@ -26,12 +26,16 @@
class IRuntimeInfo(Interface):
- """ Runtime Information Adapter for Application Control """
+ """Runtime Information Adapter for Application Control"""
def getPreferredEncoding():
"""Return the encoding used for text data, according
to user system preferences"""
+ def getFileSystemEncoding():
+ """Return the name of the encoding used to convert
+ Unicode filenames into system file names"""
+
def getZopeVersion():
"""Return a string containing the descriptive version of the
current zope installation"""
@@ -41,8 +45,8 @@
of the python interpreter"""
def getPythonPath():
- """Return a tuple containing the lookup paths of the python interpreter
- """
+ """Return a tuple containing an unicode strings containing
+ the lookup paths of the python interpreter"""
def getSystemPlatform():
"""Return an unicode string containing the system platform name
@@ -52,11 +56,10 @@
"""Return the command line string Zope was invoked with"""
def getProcessId():
- """Return the process id number currently serving the request
- """
+ """Return the process id number currently serving the request"""
def getUptime():
- """Return the Zope server uptime in seconds."""
+ """Return the Zope server uptime in seconds"""
class IZopeVersion(Interface):
=== Zope3/src/zope/app/applicationcontrol/runtimeinfo.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/applicationcontrol/runtimeinfo.py:1.6 Tue Mar 23 08:35:07 2004
+++ Zope3/src/zope/app/applicationcontrol/runtimeinfo.py Wed Mar 24 06:13:13 2004
@@ -38,9 +38,18 @@
def getPreferredEncoding(self):
"""See zope.app.applicationcontrol.interfaces.IRuntimeInfo"""
if locale is None:
- # XXX: sys.getdefaultencoding()?
- return "Latin1"
- return locale.getpreferredencoding()
+ return sys.getdefaultencoding()
+ try:
+ return locale.getpreferredencoding()
+ except locale.Error:
+ return sys.getdefaultencoding()
+
+ def getFileSystemEncoding(self):
+ """See zope.app.applicationcontrol.interfaces.IRuntimeInfo"""
+ enc = sys.getfilesystemencoding()
+ if enc is None:
+ enc = self.getPreferredEncoding()
+ return enc
def getZopeVersion(self):
"""See zope.app.applicationcontrol.interfaces.IRuntimeInfo"""
@@ -56,10 +65,12 @@
def getPythonPath(self):
"""See zope.app.applicationcontrol.interfaces.IRuntimeInfo"""
- return tuple(map(str, sys.path))
+ enc = self.getFileSystemEncoding()
+ return tuple([unicode(path, enc) for path in sys.path])
def getSystemPlatform(self):
"""See zope.app.applicationcontrol.interfaces.IRuntimeInfo"""
+ # FIXME: platform.platform()?
if hasattr(os, "uname"):
info = os.uname()
else:
More information about the Zope3-Checkins
mailing list