Skip to content

Commit

Permalink
Convert the formatted date to an unicode instance
Browse files Browse the repository at this point in the history
Genshi requires unicode instance if the string
contains non-ASCII characters.
  • Loading branch information
nb committed Aug 23, 2012
1 parent eb0e715 commit fce63fb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions code_comments/comment.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import re
import locale

import trac.wiki.formatter
from trac.mimeview.api import Context
from time import gmtime, strftime
from time import strftime, localtime
from code_comments import db
from trac.util import Markup

Expand Down Expand Up @@ -113,7 +114,8 @@ def path_link_tag(self):
return Markup('<a href="%s">%s</a>' % (self.href(), self.link_text()))

def formatted_date(self):
return strftime('%d %b %Y, %H:%M', gmtime(self.time))
encoding = locale.getlocale()[1] if locale.getlocale()[1] else 'utf-8'
return strftime('%d %b %Y, %H:%M', localtime(self.time)).decode(encoding)

def get_ticket_relations(self):
relations = set()
Expand Down

0 comments on commit fce63fb

Please # to comment.