diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-10-24 07:14:30 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-10-24 07:14:30 +0000 |
| commit | 92a6c1429162d132a00c8b06efc960ba1d2dcc3e (patch) | |
| tree | 550214667c3836ef8a99ded6a78aaf532a926d3e /django/forms | |
| parent | 3b5d975ff67cfeebc4ec8f49b7a851aa3b7401e9 (diff) | |
Fixed #9384 -- Fixed a couple of typos. Thanks, Thomas Güttler and romke.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9255 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/fields.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py index b20beb939f..2420e2050a 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -667,7 +667,7 @@ class TypedChoiceField(ChoiceField): self.coerce = kwargs.pop('coerce', lambda val: val) self.empty_value = kwargs.pop('empty_value', '') super(TypedChoiceField, self).__init__(*args, **kwargs) - + def clean(self, value): """ Validate that the value is in self.choices and can be coerced to the @@ -676,12 +676,12 @@ class TypedChoiceField(ChoiceField): value = super(TypedChoiceField, self).clean(value) if value == self.empty_value or value in EMPTY_VALUES: return self.empty_value - + # Hack alert: This field is purpose-made to use with Field.to_python as # a coercion function so that ModelForms with choices work. However, - # Django's Field.to_python raises django.core.exceptions.ValidationError, - # which is a *different* exception than - # django.forms.utils.ValidationError. So unfortunatly we need to catch + # Django's Field.to_python raises + # django.core.exceptions.ValidationError, which is a *different* + # exception than django.forms.util.ValidationError. So we need to catch # both. try: value = self.coerce(value) |
