Skip to content

Commit fce63fb

Browse files
committed
Convert the formatted date to an unicode instance
Genshi requires unicode instance if the string contains non-ASCII characters.
1 parent eb0e715 commit fce63fb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

code_comments/comment.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import re
2+
import locale
23

34
import trac.wiki.formatter
45
from trac.mimeview.api import Context
5-
from time import gmtime, strftime
6+
from time import strftime, localtime
67
from code_comments import db
78
from trac.util import Markup
89

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

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

118120
def get_ticket_relations(self):
119121
relations = set()

0 commit comments

Comments
 (0)