summaryrefslogtreecommitdiff
path: root/django/utils/dateformat.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-07-21 10:00:10 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-08-07 12:00:22 +0200
commitc5ef65bcf324f4c90b53be90f4aec069a68e8c59 (patch)
treebb9a4988fbae4e7366cc578ca845c49003cdcd64 /django/utils/dateformat.py
parentee191715eae73362768184aa95206cf61bac5d38 (diff)
[py3] Ported django.utils.encoding.
* Renamed smart_unicode to smart_text (but kept the old name under Python 2 for backwards compatibility). * Renamed smart_str to smart_bytes. * Re-introduced smart_str as an alias for smart_text under Python 3 and smart_bytes under Python 2 (which is backwards compatible). Thus smart_str always returns a str objects. * Used the new smart_str in a few places where both Python 2 and 3 want a str.
Diffstat (limited to 'django/utils/dateformat.py')
-rw-r--r--django/utils/dateformat.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/django/utils/dateformat.py b/django/utils/dateformat.py
index c9a6138aed..6a91a370e5 100644
--- a/django/utils/dateformat.py
+++ b/django/utils/dateformat.py
@@ -20,7 +20,7 @@ import datetime
from django.utils.dates import MONTHS, MONTHS_3, MONTHS_ALT, MONTHS_AP, WEEKDAYS, WEEKDAYS_ABBR
from django.utils.tzinfo import LocalTimezone
from django.utils.translation import ugettext as _
-from django.utils.encoding import force_unicode
+from django.utils.encoding import force_text
from django.utils import six
from django.utils.timezone import is_aware, is_naive
@@ -30,9 +30,9 @@ re_escaped = re.compile(r'\\(.)')
class Formatter(object):
def format(self, formatstr):
pieces = []
- for i, piece in enumerate(re_formatchars.split(force_unicode(formatstr))):
+ for i, piece in enumerate(re_formatchars.split(force_text(formatstr))):
if i % 2:
- pieces.append(force_unicode(getattr(self, piece)()))
+ pieces.append(force_text(getattr(self, piece)()))
elif piece:
pieces.append(re_escaped.sub(r'\1', piece))
return ''.join(pieces)