From 08a4b7328036c0d27c03418c9933e89465c7dec3 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sun, 21 Apr 2013 19:30:02 -0400 Subject: forced utf8 encoding on all stderr printing --- askbot/mail/lamson_handlers.py | 4 ++-- askbot/startup_procedures.py | 2 +- askbot/tasks.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/askbot/mail/lamson_handlers.py b/askbot/mail/lamson_handlers.py index 8bfa86f7..65e5fde0 100644 --- a/askbot/mail/lamson_handlers.py +++ b/askbot/mail/lamson_handlers.py @@ -160,9 +160,9 @@ def process_reply(func): received the notification.") except Exception, e: import sys - sys.stderr.write(str(e)) + sys.stderr.write(unicode(e).encode('utf-8')) import traceback - sys.stderr.write(traceback.format_exc()) + sys.stderr.write(unicode(traceback.format_exc()).encode('utf-8')) if error is not None: template = get_template('email/reply_by_email_error.html') diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index 76893eff..d91464f4 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -45,7 +45,7 @@ class AskbotConfigError(ImproperlyConfigured): def askbot_warning(line): """prints a warning with the nice header, but does not quit""" - print >> sys.stderr, line + print >> sys.stderr, unicode(line).encode('utf-8') def print_errors(error_messages, header = None, footer = None): """if there is one or more error messages, diff --git a/askbot/tasks.py b/askbot/tasks.py index 8d98be2c..fba4a556 100644 --- a/askbot/tasks.py +++ b/askbot/tasks.py @@ -160,7 +160,7 @@ def record_post_update_celery_task( # HACK: exceptions from Celery job don't propagate upwards # to the Django test runner # so at least let's print tracebacks - print >>sys.stderr, traceback.format_exc() + print >>sys.stderr, unicode(traceback.format_exc()).encode('utf-8') raise @task(ignore_result = True) -- cgit v1.2.3-1-g7c22