Skip to content

Commit a5de16f

Browse files
committed
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
1 parent 7f5797e commit a5de16f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

django/newforms/fields.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,7 @@ def clean(self, value):
446446
return []
447447
if not isinstance(value, (list, tuple)):
448448
raise ValidationError(ugettext(u'Enter a list of values.'))
449-
new_value = []
450-
for val in value:
451-
val = smart_unicode(val)
452-
new_value.append(val)
449+
new_value = [smart_unicode(val) for val in value]
453450
# Validate that each value in the value list is in self.choices.
454451
valid_values = set([smart_unicode(k) for k, v in self.choices])
455452
for val in new_value:

0 commit comments

Comments
 (0)