script-publish.py: Don't print raw strings to the log
authorW. Trevor King <wking@tremily.us>
Sun, 13 Jan 2013 15:23:08 +0000 (10:23 -0500)
committerW. Trevor King <wking@tremily.us>
Sun, 13 Jan 2013 15:23:08 +0000 (10:23 -0500)
Print their repr() instead, since the strings may contain funky
characters and missed control codes.

posts/script/script-publish.py

index ea47b2cff2f98ae949564017fe7af933c456d592..4f750e481091a68eee7139cce5a84a87fc52922c 100755 (executable)
@@ -597,7 +597,10 @@ class ControlParser (object):
         chunks = self._replace_control_codes(text)
         chunks = self._decode_text(chunks)
         for chunk in chunks:
-            _LOG.debug(chunk)
+            if isinstance(chunk, str):
+                _LOG.debug(repr(chunk))
+            else:
+                _LOG.debug(chunk)
         chunks = self._replace_tabs(chunks)
         chunks = self._merge_adjacent_text(chunks)
         chunks = self._remove_operating_system_commands(chunks)