[CalendarServer-changes] [11728] CalendarServer/branches/users/glyph/log-cleanups/twext/python/log. py

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 17 16:02:35 PDT 2013


Revision: 11728
          http://trac.calendarserver.org//changeset/11728
Author:   glyph at apple.com
Date:     2013-09-17 16:02:34 -0700 (Tue, 17 Sep 2013)
Log Message:
-----------
Shorten the implementation.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/log-cleanups/twext/python/log.py

Modified: CalendarServer/branches/users/glyph/log-cleanups/twext/python/log.py
===================================================================
--- CalendarServer/branches/users/glyph/log-cleanups/twext/python/log.py	2013-09-17 23:02:34 UTC (rev 11727)
+++ CalendarServer/branches/users/glyph/log-cleanups/twext/python/log.py	2013-09-17 23:02:34 UTC (rev 11728)
@@ -240,23 +240,9 @@
         # logger.
         failure = Failure()
 
-        items = []
+        text = ", ".join(" = ".join((safe_repr(key), safe_repr(value)))
+                         for key, value in event.items())
 
-        for key, value in event.items():
-            try:
-                keyFormatted = u"{key!r}".format(key=key)
-            except BaseException:
-                keyFormatted = u"<UNFORMATTABLE KEY>"
-
-            try:
-                valueFormatted = u"{value!r}".format(value=value)
-            except BaseException:
-                valueFormatted = u"<UNFORMATTABLE VALUE>"
-
-            items.append(" = ".join((keyFormatted, valueFormatted)))
-
-        text = ", ".join(items)
-
         return (
             u"MESSAGE LOST: unformattable object logged: {error}\n"
             u"Recoverable data: {text}\n"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130917/8545a1bd/attachment-0001.html>


More information about the calendarserver-changes mailing list