#9938: ModelChoiceField validation throws OverflowError
-----------------------+----------------------------------------------------
Reporter: bstpierre | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Keywords: | Stage: Unreviewed
Has_patch: 0 |
-----------------------+----------------------------------------------------
I have a form that uses ModelChoiceField.
My unit tests throw strings and very large integers at the
ModelChoiceField field. I expect the clean() method to trap any bad input
so that I don't have to. Sending strings ("abcd") or very large integers
(01234567890123456789012345678901234567890123456789) causes exceptions.
To reproduce, I'm attaching a minimal django project as a tarball.
I'm also attaching a patch that fixes these two cases. Not sure if there's
a better fix that would be preferred.
Using svn 9692.
Test case:
1. tar zxvf overflow.tgz
2. ./manage.py syncdb --noinput [db is sqlite3 in /tmp/deleteme.sqlite3]
3. ./manage.py runserver
4. browse to
http://127.0.0.1:8000/overflow/?blog=1234567890123456789012345678901234567890123456789,
expect to see "invalid" but instead get Django error page (OverflowError)
5. browse to http://127.0.0.1:8000/overflow/?blog=foo, expect to see
"invalid" but instead get Django error page (ValueError)
--
Ticket URL: <http://code.djangoproject.com/ticket/9938>
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
-~----------~----~----~----~------~----~------~--~---