Commit c1a59cc0 by Peter Fogg

Fix date summaries with Unicode format issues.

This issue would show up when date formatting strings are translated
with Unicode characters (like when testing with fake Esperanto
translations).
parent 01fca6b6
......@@ -111,7 +111,7 @@ class DateSummary(object):
date_format = _(u"{relative} ago - {absolute}") if date_has_passed else _(u"in {relative} - {absolute}")
return date_format.format(
relative=relative_date,
absolute=self.date.strftime(self.date_format),
absolute=self.date.strftime(self.date_format.encode('utf-8')).decode('utf-8'),
)
@property
......@@ -157,7 +157,9 @@ class TodaysDate(DateSummary):
@property
def title(self):
return _(u'Today is {date}').format(date=datetime.now(pytz.UTC).strftime(self.date_format))
return _(u'Today is {date}').format(
date=datetime.now(pytz.UTC).strftime(self.date_format.encode('utf-8')).decode('utf-8')
)
class CourseStartDate(DateSummary):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment