[CalendarServer-changes] [15283] twext/trunk/twext/python/log.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Nov 4 09:16:23 PST 2015


Revision: 15283
          http://trac.calendarserver.org//changeset/15283
Author:   cdaboo at apple.com
Date:     2015-11-04 09:16:23 -0800 (Wed, 04 Nov 2015)
Log Message:
-----------
Always process Logger strings as utf-8 encoded.

Modified Paths:
--------------
    twext/trunk/twext/python/log.py

Modified: twext/trunk/twext/python/log.py
===================================================================
--- twext/trunk/twext/python/log.py	2015-11-04 15:12:27 UTC (rev 15282)
+++ twext/trunk/twext/python/log.py	2015-11-04 17:16:23 UTC (rev 15283)
@@ -350,6 +350,13 @@
             # FIXME: continue to emit?
             return
 
+        # Assume that any L{bytes} in the format or kwargs are utf-8 encoded strings
+        if format is not None and isinstance(format, bytes):
+            format = format.decode("utf-8")
+        for k, v in kwargs.items():
+            if isinstance(v, bytes):
+                kwargs[k] = v.decode("utf-8")
+
         kwargs.update(
             log_logger=self, log_level=level, log_namespace=self.namespace,
             log_source=self.source, log_format=format, log_time=time.time(),
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151104/ca3278e3/attachment-0001.html>


More information about the calendarserver-changes mailing list