diff --git a/django/conf/locale/ar/formats.py b/django/conf/locale/ar/formats.py index 3b47429ece..213e5b363f 100644 --- a/django/conf/locale/ar/formats.py +++ b/django/conf/locale/ar/formats.py @@ -1,6 +1,7 @@ # -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # +from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date diff --git a/django/conf/locale/fa/formats.py b/django/conf/locale/fa/formats.py index 7225a62995..5682c410e2 100644 --- a/django/conf/locale/fa/formats.py +++ b/django/conf/locale/fa/formats.py @@ -1,6 +1,7 @@ # -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # +from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date diff --git a/django/contrib/localflavor/ca/forms.py b/django/contrib/localflavor/ca/forms.py index ec66e66539..daa40044f9 100644 --- a/django/contrib/localflavor/ca/forms.py +++ b/django/contrib/localflavor/ca/forms.py @@ -79,9 +79,9 @@ class CAProvinceField(Field): pass else: # Load data in memory only when it is required, see also #17275 - from django.contrib.localflavor.ca.ca_provinces import PROVINCES_NORMALIZED + from .ca_provinces import PROVINCES_NORMALIZED try: - return PROVINCES_NORMALIZED[value.strip().lower()].decode('ascii') + return PROVINCES_NORMALIZED[value.strip().lower()] except KeyError: pass raise ValidationError(self.error_messages['invalid']) @@ -93,7 +93,7 @@ class CAProvinceSelect(Select): """ def __init__(self, attrs=None): # Load data in memory only when it is required, see also #17275 - from django.contrib.localflavor.ca.ca_provinces import PROVINCE_CHOICES + from .ca_provinces import PROVINCE_CHOICES super(CAProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES) class CASocialInsuranceNumberField(Field): diff --git a/django/contrib/localflavor/es/forms.py b/django/contrib/localflavor/es/forms.py index b5e256ca44..da0769d2a0 100644 --- a/django/contrib/localflavor/es/forms.py +++ b/django/contrib/localflavor/es/forms.py @@ -3,7 +3,7 @@ Spanish-specific Form helpers """ -from __future__ import absolute_import +from __future__ import absolute_import, unicode_literals import re diff --git a/django/contrib/localflavor/tr/tr_provinces.py b/django/contrib/localflavor/tr/tr_provinces.py index 060a6cdaf6..edad74710d 100644 --- a/django/contrib/localflavor/tr/tr_provinces.py +++ b/django/contrib/localflavor/tr/tr_provinces.py @@ -3,6 +3,7 @@ This exists in this standalone file so that it's only imported into memory when explicitly needed. """ +from __future__ import unicode_literals PROVINCE_CHOICES = ( ('01', ('Adana')), diff --git a/django/contrib/localflavor/us/forms.py b/django/contrib/localflavor/us/forms.py index 33e533b4ce..ef565163cd 100644 --- a/django/contrib/localflavor/us/forms.py +++ b/django/contrib/localflavor/us/forms.py @@ -93,7 +93,7 @@ class USStateField(Field): } def clean(self, value): - from django.contrib.localflavor.us.us_states import STATES_NORMALIZED + from .us_states import STATES_NORMALIZED super(USStateField, self).clean(value) if value in EMPTY_VALUES: return '' @@ -103,7 +103,7 @@ class USStateField(Field): pass else: try: - return STATES_NORMALIZED[value.strip().lower()].decode('ascii') + return STATES_NORMALIZED[value.strip().lower()] except KeyError: pass raise ValidationError(self.error_messages['invalid']) @@ -113,7 +113,7 @@ class USStateSelect(Select): A Select widget that uses a list of U.S. states/territories as its choices. """ def __init__(self, attrs=None): - from django.contrib.localflavor.us.us_states import STATE_CHOICES + from .us_states import STATE_CHOICES super(USStateSelect, self).__init__(attrs, choices=STATE_CHOICES) class USPSSelect(Select): @@ -122,5 +122,5 @@ class USPSSelect(Select): choices. """ def __init__(self, attrs=None): - from django.contrib.localflavor.us.us_states import USPS_CHOICES + from .us_states import USPS_CHOICES super(USPSSelect, self).__init__(attrs, choices=USPS_CHOICES) diff --git a/tests/regressiontests/localflavor/mk/tests.py b/tests/regressiontests/localflavor/mk/tests.py index fdc9932f6a..dbf4c2b2d9 100644 --- a/tests/regressiontests/localflavor/mk/tests.py +++ b/tests/regressiontests/localflavor/mk/tests.py @@ -92,11 +92,11 @@ class MKLocalFlavorTests(SimpleTestCase): """ Test that the empty option is there. """ - municipality_select_html = b"""\ + municipality_select_html = """\ """ self.assertHTMLEqual(str(self.form['municipality']), municipality_select_html)