[Checkins] SVN: refline.srccheck/trunk/ Fix unicode encoding issues in CSSChecker

Adam Groszer cvs-admin at zope.org
Wed Apr 4 08:33:34 UTC 2012


Log message for revision 124934:
  Fix unicode encoding issues in CSSChecker

Changed:
  U   refline.srccheck/trunk/CHANGES.txt
  U   refline.srccheck/trunk/src/refline/srccheck/checker.py

-=-
Modified: refline.srccheck/trunk/CHANGES.txt
===================================================================
--- refline.srccheck/trunk/CHANGES.txt	2012-04-04 08:29:04 UTC (rev 124933)
+++ refline.srccheck/trunk/CHANGES.txt	2012-04-04 08:33:30 UTC (rev 124934)
@@ -4,7 +4,7 @@
 0.5.2 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Fix unicode encoding issues in CSSChecker
 
 
 0.5.1 (2012-04-04)

Modified: refline.srccheck/trunk/src/refline/srccheck/checker.py
===================================================================
--- refline.srccheck/trunk/src/refline/srccheck/checker.py	2012-04-04 08:29:04 UTC (rev 124933)
+++ refline.srccheck/trunk/src/refline/srccheck/checker.py	2012-04-04 08:33:30 UTC (rev 124934)
@@ -245,7 +245,11 @@
     removeHandler = noop
 
     def error(self, msg):
-        self.checker.error = msg
+        try:
+            self.checker.error = str(msg)
+        except UnicodeEncodeError:
+            # unicode in doctests drives me mad
+            self.checker.error = msg.encode('ascii', 'replace')
         # can't add much help, all info is encoded in msg
         self.checker.log(0)
 



More information about the checkins mailing list