aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTryggvi Bjorgvinsson <tryggvib@fsfi.is>2014-02-28 23:25:02 +0000
committerJessica Tallon <jessica@megworld.co.uk>2014-07-18 15:27:35 +0100
commit09bed9a7328c806873405bd2ec5a5cf72930e89c (patch)
tree128b92334716663eb229f6f680f2a08326dd1648
parent8c311def96a8e68afeedeb43b38ee019788ca542 (diff)
downloadmediagoblin-09bed9a7328c806873405bd2ec5a5cf72930e89c.tar.lz
mediagoblin-09bed9a7328c806873405bd2ec5a5cf72930e89c.tar.xz
mediagoblin-09bed9a7328c806873405bd2ec5a5cf72930e89c.zip
Use unicode for logging comments
The comment problems detailed in issue 791 are related to logging of comments creation. The log tries to format unicode comments into an ascii string (that is the unicode comment content). This also creates problems with mark seen functionality since that also logs the comments which breaks and you end up with a lot of international comments in your message queue. This commit makes both log messages unicode as well as the representation of the comment.
-rw-r--r--mediagoblin/db/mixin.py2
-rw-r--r--mediagoblin/db/models.py2
-rw-r--r--mediagoblin/notifications/__init__.py2
-rw-r--r--mediagoblin/notifications/task.py2
4 files changed, 4 insertions, 4 deletions
diff --git a/mediagoblin/db/mixin.py b/mediagoblin/db/mixin.py
index 048cc07c..3d96ba34 100644
--- a/mediagoblin/db/mixin.py
+++ b/mediagoblin/db/mixin.py
@@ -295,7 +295,7 @@ class MediaCommentMixin(object):
return cleaned_markdown_conversion(self.content)
def __repr__(self):
- return '<{klass} #{id} {author} "{comment}">'.format(
+ return u'<{klass} #{id} {author} "{comment}">'.format(
klass=self.__class__.__name__,
id=self.id,
author=self.get_author,
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 643d5d41..4c9345fc 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -666,7 +666,7 @@ class Notification(Base):
}
def __repr__(self):
- return '<{klass} #{id}: {user}: {subject} ({seen})>'.format(
+ return u'<{klass} #{id}: {user}: {subject} ({seen})>'.format(
id=self.id,
klass=self.__class__.__name__,
user=self.user,
diff --git a/mediagoblin/notifications/__init__.py b/mediagoblin/notifications/__init__.py
index b6f9f478..c7a9a1fb 100644
--- a/mediagoblin/notifications/__init__.py
+++ b/mediagoblin/notifications/__init__.py
@@ -65,7 +65,7 @@ def mark_comment_notification_seen(comment_id, user):
user_id=user.id,
subject_id=comment_id).first()
- _log.debug('Marking {0} as seen.'.format(notification))
+ _log.debug(u'Marking {0} as seen.'.format(notification))
mark_notification_seen(notification)
diff --git a/mediagoblin/notifications/task.py b/mediagoblin/notifications/task.py
index 52573b57..d915212a 100644
--- a/mediagoblin/notifications/task.py
+++ b/mediagoblin/notifications/task.py
@@ -35,7 +35,7 @@ class EmailNotificationTask(Task):
'''
def run(self, notification_id, message):
cn = CommentNotification.query.filter_by(id=notification_id).first()
- _log.info('Sending notification email about {0}'.format(cn))
+ _log.info(u'Sending notification email about {0}'.format(cn))
return send_email(
message['from'],