commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9805 - trunk/gnue-common/src/base


From: johannes
Subject: [gnue] r9805 - trunk/gnue-common/src/base
Date: Wed, 14 Nov 2007 08:53:15 -0600 (CST)

Author: johannes
Date: 2007-11-14 08:53:15 -0600 (Wed, 14 Nov 2007)
New Revision: 9805

Modified:
   trunk/gnue-common/src/base/errors.py
Log:
Made to_unicode() more private


Modified: trunk/gnue-common/src/base/errors.py
===================================================================
--- trunk/gnue-common/src/base/errors.py        2007-11-14 14:46:36 UTC (rev 
9804)
+++ trunk/gnue-common/src/base/errors.py        2007-11-14 14:53:15 UTC (rev 
9805)
@@ -83,7 +83,7 @@
         @rtype: Unicode
         """
         rep = self.name or "%s" % (sys.exc_info()[0] or exc_type)
-        return to_unicode(rep.split('.')[-1])
+        return _unicode(rep.split('.')[-1])
 
 
     # -------------------------------------------------------------------------
@@ -103,7 +103,7 @@
         @rtype: Unicode
         """
         if self.detail is not None:
-            return to_unicode(self.detail, i18n.get_encoding())
+            return _unicode(self.detail, i18n.get_encoding())
 
         (stype, svalue, strace) = sys.exc_info()
         stype  = stype or etype
@@ -114,7 +114,7 @@
         if count is not None:
             del tStack[1:count + 1]
 
-        return to_unicode("%s" % ''.join(tStack), i18n.get_encoding())
+        return _unicode("%s" % ''.join(tStack), i18n.get_encoding())
 
 
 
@@ -240,8 +240,15 @@
 # Create a unicode string using a given encoding
 # -----------------------------------------------------------------------------
 
-def to_unicode(text, encoding=None):
+def _unicode(text, encoding=None):
+    """
+    Convert the given text into unicode using the optionally passed encoding.
+    If no encoding is specified the systems' default encoding will be used.
 
+    @returns: the text in unicode
+    @rtype: unicode
+    """
+
     result = text
 
     if isinstance(text, str):





reply via email to

[Prev in Thread] Current Thread [Next in Thread]