Kaydet (Commit) a5de16fb authored tarafından Russell Keith-Magee's avatar Russell Keith-Magee

Fixed #4755 -- Modified newforms MultipleChoiceField to use list comprehension,…

Fixed #4755 -- Modified newforms MultipleChoiceField to use list comprehension, rather than iteration.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5669 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst 7f5797e6
...@@ -446,10 +446,7 @@ class MultipleChoiceField(ChoiceField): ...@@ -446,10 +446,7 @@ class MultipleChoiceField(ChoiceField):
return [] return []
if not isinstance(value, (list, tuple)): if not isinstance(value, (list, tuple)):
raise ValidationError(ugettext(u'Enter a list of values.')) raise ValidationError(ugettext(u'Enter a list of values.'))
new_value = [] new_value = [smart_unicode(val) for val in value]
for val in value:
val = smart_unicode(val)
new_value.append(val)
# Validate that each value in the value list is in self.choices. # Validate that each value in the value list is in self.choices.
valid_values = set([smart_unicode(k) for k, v in self.choices]) valid_values = set([smart_unicode(k) for k, v in self.choices])
for val in new_value: for val in new_value:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment