diff options
| author | Boulder Sprinters <boulder-sprinters@djangoproject.com> | 2007-03-09 17:43:46 +0000 |
|---|---|---|
| committer | Boulder Sprinters <boulder-sprinters@djangoproject.com> | 2007-03-09 17:43:46 +0000 |
| commit | 0b7dd14d1f87e2ecef7aacc39fe4189667ed4fdf (patch) | |
| tree | b77497f9de324d38a9c6341e54d2742633e20055 /django/newforms/fields.py | |
| parent | e17f75551491f5b864c1fc8a97c21d0b2bbf0bcd (diff) | |
boulder-oracle-sprint: Merged to trunk [4692].
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@4695 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/newforms/fields.py')
| -rw-r--r-- | django/newforms/fields.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/django/newforms/fields.py b/django/newforms/fields.py index e9e1fb7746..8e3da03470 100644 --- a/django/newforms/fields.py +++ b/django/newforms/fields.py @@ -51,7 +51,7 @@ class Field(object): if label is not None: label = smart_unicode(label) self.required, self.label, self.initial = required, label, initial - self.help_text = help_text + self.help_text = smart_unicode(help_text or '') widget = widget or self.widget if isinstance(widget, type): widget = widget() @@ -339,8 +339,9 @@ class ChoiceField(Field): def _set_choices(self, value): # Setting choices also sets the choices on the widget. - self._choices = value - self.widget.choices = value + # choices can be any iterable, but we call list() on it because + # it will be consumed more than once. + self._choices = self.widget.choices = list(value) choices = property(_get_choices, _set_choices) @@ -356,7 +357,7 @@ class ChoiceField(Field): return value valid_values = set([str(k) for k, v in self.choices]) if value not in valid_values: - raise ValidationError(gettext(u'Select a valid choice. %s is not one of the available choices.') % value) + raise ValidationError(gettext(u'Select a valid choice. That choice is not one of the available choices.')) return value class MultipleChoiceField(ChoiceField): |
