aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Logging
diff options
context:
space:
mode:
authortkikuchi <>2005-12-17 02:30:04 +0000
committertkikuchi <>2005-12-17 02:30:04 +0000
commit4fc195111db5d68eb97d259ed8bc67beae95302d (patch)
tree7bffbb6a3238b0b0ab5bf7f45ccb8678e7c6b079 /Mailman/Logging
parent951fe5b55066ae6f2f1e8378c62cff879801dd0a (diff)
downloadmailman2-4fc195111db5d68eb97d259ed8bc67beae95302d.tar.gz
mailman2-4fc195111db5d68eb97d259ed8bc67beae95302d.tar.xz
mailman2-4fc195111db5d68eb97d259ed8bc67beae95302d.zip
Python 2.4 may fail to write 8bit (non-ascii) characters.
I think quoted-printable is the safest escape for logging.
Diffstat (limited to 'Mailman/Logging')
-rw-r--r--Mailman/Logging/Syslog.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Mailman/Logging/Syslog.py b/Mailman/Logging/Syslog.py
index b680d7f9..654ce64c 100644
--- a/Mailman/Logging/Syslog.py
+++ b/Mailman/Logging/Syslog.py
@@ -55,7 +55,12 @@ class _Syslog:
# It's really bad if exceptions in the syslogger cause other crashes
except Exception, e:
msg = 'Bad format "%s": %s: %s' % (origmsg, repr(e), e)
- logf.write(msg + '\n')
+ try:
+ logf.write(msg + '\n')
+ except UnicodeError:
+ # Python 2.4 may fail to write 8bit (non-ascii) characters
+ import quopri
+ logf.write(quopri.encodestring(msg) + '\n')
# For the ultimate in convenience
__call__ = write