]> granicus.if.org Git - python/commitdiff
Fixed bug where the logging message was wrongly being demoted from Unicode to string...
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 7 Oct 2005 08:35:36 +0000 (08:35 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 7 Oct 2005 08:35:36 +0000 (08:35 +0000)
Lib/logging/__init__.py

index 4dab918c8523d605e67e20f8a0f89e1021b3c07e..db7029321d30578e3e44e9a30aca7934bbe8a8bd 100644 (file)
@@ -41,8 +41,8 @@ except ImportError:
 
 __author__  = "Vinay Sajip <vinay_sajip@red-dove.com>"
 __status__  = "beta"
-__version__ = "0.4.9.6"
-__date__    = "27 March 2005"
+__version__ = "0.4.9.7"
+__date__    = "07 October 2005"
 
 #---------------------------------------------------------------------------
 #   Miscellaneous module data
@@ -266,10 +266,12 @@ class LogRecord:
         if not hasattr(types, "UnicodeType"): #if no unicode support...
             msg = str(self.msg)
         else:
-            try:
-                msg = str(self.msg)
-            except UnicodeError:
-                msg = self.msg      #Defer encoding till later
+            msg = self.msg
+            if type(msg) not in (types.UnicodeType, types.StringType):
+                try:
+                    msg = str(self.msg)
+                except UnicodeError:
+                    msg = self.msg      #Defer encoding till later
         if self.args:
             msg = msg % self.args
         return msg