#9938: ModelChoiceField validation throws OverflowError
---------------------------------+------------------------------------------
          Reporter:  bstpierre   |         Owner:  nobody
            Status:  new         |     Milestone:        
         Component:  Forms       |       Version:  SVN   
        Resolution:              |      Keywords:        
             Stage:  Unreviewed  |     Has_patch:  1     
        Needs_docs:  0           |   Needs_tests:  0     
Needs_better_patch:  0           |  
---------------------------------+------------------------------------------
Changes (by bstpierre):

  * needs_better_patch:  => 0
  * has_patch:  0 => 1
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 Index: django/forms/models.py
 ===================================================================
 --- django/forms/models.py      (revision 9692)
 +++ django/forms/models.py      (working copy)
 @@ -705,6 +705,12 @@
              value = self.queryset.get(**{key: value})
          except self.queryset.model.DoesNotExist:
              raise ValidationError(self.error_messages['invalid_choice'])
 +        except ValueError:
 +            # Raised when string is passed.
 +            raise ValidationError(self.error_messages['invalid_choice'])
 +        except OverflowError:
 +            # Raised when ridiculously large integer is passed.
 +            raise ValidationError(self.error_messages['invalid_choice'])
          return value

  class ModelMultipleChoiceField(ModelChoiceField):

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9938#comment:1>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to