Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleaned up locale-related encoding issues

  • Loading branch information...
commit 35f9c2c07a8ed29b278db21a61f5b87581024258 1 parent 3dd5d72
Claude Paroz claudep authored
1  django/conf/locale/ar/formats.py
View
@@ -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
1  django/conf/locale/fa/formats.py
View
@@ -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
6 django/contrib/localflavor/ca/forms.py
View
@@ -79,9 +79,9 @@ def clean(self, value):
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):
2  django/contrib/localflavor/es/forms.py
View
@@ -3,7 +3,7 @@
Spanish-specific Form helpers
"""
-from __future__ import absolute_import
+from __future__ import absolute_import, unicode_literals
import re
1  django/contrib/localflavor/tr/tr_provinces.py
View
@@ -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')),
8 django/contrib/localflavor/us/forms.py
View
@@ -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 @@ def clean(self, value):
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)
56 tests/regressiontests/localflavor/mk/tests.py
View
@@ -92,11 +92,11 @@ def test_field_blank_option(self):
"""
Test that the empty option is there.
"""
- municipality_select_html = b"""\
+ municipality_select_html = """\
<select name="municipality" id="id_municipality">
<option value="">---------</option>
<option value="AD">Aerodrom</option>
-<option value="AR">Ara\xc4\x8dinovo</option>
+<option value="AR">Aračinovo</option>
<option value="BR">Berovo</option>
<option value="TL">Bitola</option>
<option value="BG">Bogdanci</option>
@@ -106,24 +106,24 @@ def test_field_blank_option(self):
<option value="BU">Butel</option>
<option value="VA">Valandovo</option>
<option value="VL">Vasilevo</option>
-<option value="VV">Vev\xc4\x8dani</option>
+<option value="VV">Vevčani</option>
<option value="VE">Veles</option>
<option value="NI">Vinica</option>
-<option value="VC">Vrane\xc5\xa1tica</option>
-<option value="VH">Vrap\xc4\x8di\xc5\xa1te</option>
+<option value="VC">Vraneštica</option>
+<option value="VH">Vrapčište</option>
<option value="GB">Gazi Baba</option>
<option value="GV">Gevgelija</option>
<option value="GT">Gostivar</option>
<option value="GR">Gradsko</option>
<option value="DB">Debar</option>
<option value="DA">Debarca</option>
-<option value="DL">Del\xc4\x8devo</option>
+<option value="DL">Delčevo</option>
<option value="DK">Demir Kapija</option>
<option value="DM">Demir Hisar</option>
<option value="DE">Dolneni</option>
<option value="DR">Drugovo</option>
-<option value="GP">Gjor\xc4\x8de Petrov</option>
-<option value="ZE">\xc5\xbdelino</option>
+<option value="GP">Gjorče Petrov</option>
+<option value="ZE">Želino</option>
<option value="ZA">Zajas</option>
<option value="ZK">Zelenikovo</option>
<option value="ZR">Zrnovci</option>
@@ -131,19 +131,19 @@ def test_field_blank_option(self):
<option value="JG">Jegunovce</option>
<option value="AV">Kavadarci</option>
<option value="KB">Karbinci</option>
-<option value="KX">Karpo\xc5\xa1</option>
+<option value="KX">Karpoš</option>
<option value="VD">Kisela Voda</option>
-<option value="KH">Ki\xc4\x8devo</option>
-<option value="KN">Kon\xc4\x8de</option>
-<option value="OC">Ko\xc4\x87ani</option>
+<option value="KH">Kičevo</option>
+<option value="KN">Konče</option>
+<option value="OC">Koćani</option>
<option value="KY">Kratovo</option>
<option value="KZ">Kriva Palanka</option>
-<option value="KG">Krivoga\xc5\xa1tani</option>
-<option value="KS">Kru\xc5\xa1evo</option>
+<option value="KG">Krivogaštani</option>
+<option value="KS">Kruševo</option>
<option value="UM">Kumanovo</option>
<option value="LI">Lipkovo</option>
<option value="LO">Lozovo</option>
-<option value="MR">Mavrovo i Rostu\xc5\xa1a</option>
+<option value="MR">Mavrovo i Rostuša</option>
<option value="MK">Makedonska Kamenica</option>
<option value="MD">Makedonski Brod</option>
<option value="MG">Mogila</option>
@@ -153,32 +153,32 @@ def test_field_blank_option(self):
<option value="OS">Oslomej</option>
<option value="OD" selected="selected">Ohrid</option>
<option value="PE">Petrovec</option>
-<option value="PH">Peh\xc4\x8devo</option>
+<option value="PH">Pehčevo</option>
<option value="PN">Plasnica</option>
<option value="PP">Prilep</option>
-<option value="PT">Probi\xc5\xa1tip</option>
-<option value="RV">Radovi\xc5\xa1</option>
+<option value="PT">Probištip</option>
+<option value="RV">Radoviš</option>
<option value="RN">Rankovce</option>
<option value="RE">Resen</option>
<option value="RO">Rosoman</option>
<option value="AJ">Saraj</option>
<option value="SL">Sveti Nikole</option>
-<option value="SS">Sopi\xc5\xa1te</option>
+<option value="SS">Sopište</option>
<option value="SD">Star Dojran</option>
-<option value="NA">Staro Nagori\xc4\x8dane</option>
+<option value="NA">Staro Nagoričane</option>
<option value="UG">Struga</option>
<option value="RU">Strumica</option>
-<option value="SU">Studeni\xc4\x8dani</option>
+<option value="SU">Studeničani</option>
<option value="TR">Tearce</option>
<option value="ET">Tetovo</option>
<option value="CE">Centar</option>
-<option value="CZ">Centar-\xc5\xbdupa</option>
-<option value="CI">\xc4\x8cair</option>
-<option value="CA">\xc4\x8ca\xc5\xa1ka</option>
-<option value="CH">\xc4\x8ce\xc5\xa1inovo-Oble\xc5\xa1evo</option>
-<option value="CS">\xc4\x8cu\xc4\x8der-Sandevo</option>
-<option value="ST">\xc5\xa0tip</option>
-<option value="SO">\xc5\xa0uto Orizari</option>
+<option value="CZ">Centar-Župa</option>
+<option value="CI">Čair</option>
+<option value="CA">Čaška</option>
+<option value="CH">Češinovo-Obleševo</option>
+<option value="CS">Čučer-Sandevo</option>
+<option value="ST">Štip</option>
+<option value="SO">Šuto Orizari</option>
</select>"""
self.assertHTMLEqual(str(self.form['municipality']), municipality_select_html)
Please sign in to comment.
Something went wrong with that request. Please try again.