mirror of
https://github.com/django/django.git
synced 2025-07-04 01:39:20 +00:00
unicode: Fixed #4313 -- fixed a problem with unicode strings and datetime
format filters. git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5267 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
095d3ca8eb
commit
2cebf777e3
@ -14,6 +14,7 @@ Usage:
|
||||
from django.utils.dates import MONTHS, MONTHS_3, MONTHS_AP, WEEKDAYS
|
||||
from django.utils.tzinfo import LocalTimezone
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.encoding import smart_unicode
|
||||
from calendar import isleap, monthrange
|
||||
import re, time
|
||||
|
||||
@ -25,7 +26,7 @@ class Formatter(object):
|
||||
pieces = []
|
||||
for i, piece in enumerate(re_formatchars.split(formatstr)):
|
||||
if i % 2:
|
||||
pieces.append(str(getattr(self, piece)()))
|
||||
pieces.append(smart_unicode(getattr(self, piece)()))
|
||||
elif piece:
|
||||
pieces.append(re_escaped.sub(r'\1', piece))
|
||||
return u''.join(pieces)
|
||||
|
Loading…
x
Reference in New Issue
Block a user