Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #4804 -- Fixed a problem when validating choice lists with non-…

…ASCII

data. Thanks, django@vonposer.de.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5642 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 87d8976faee7b07a30ce1bd844b2b6178c3a3328 1 parent cc1a4f0
Malcolm Tredinnick malcolmt authored
4 django/oldforms/__init__.py
View
@@ -3,7 +3,7 @@
from django.utils.html import escape
from django.conf import settings
from django.utils.translation import ugettext, ungettext
-from django.utils.encoding import smart_unicode, force_unicode, smart_str
+from django.utils.encoding import smart_unicode, force_unicode
FORM_FIELD_ID_PREFIX = 'id_'
@@ -502,7 +502,7 @@ def render(self, data):
def isValidChoice(self, data, form):
str_data = smart_unicode(data)
- str_choices = [smart_str(item[0]) for item in self.choices]
+ str_choices = [smart_unicode(item[0]) for item in self.choices]
if str_data not in str_choices:
raise validators.ValidationError, ugettext("Select a valid choice; '%(data)s' is not in %(choices)s.") % {'data': str_data, 'choices': str_choices}
2  tests/modeltests/manipulators/models.py
View
@@ -54,7 +54,7 @@ def __unicode__(self):
# Attempt to create an Album with an invalid musician.
>>> man.get_validation_errors(MultiValueDict({'name': ['Sallies Fforth'], 'musician': ['foo']}))
-{'musician': [u"Select a valid choice; 'foo' is not in ['', '1']."]}
+{'musician': [u"Select a valid choice; 'foo' is not in [u'', u'1']."]}
# Attempt to create an Album with an invalid release_date.
>>> man.get_validation_errors(MultiValueDict({'name': ['Sallies Fforth'], 'musician': ['1'], 'release_date': 'today'}))
Please sign in to comment.
Something went wrong with that request. Please try again.