#11716: Various methods in django.db.models.fields don't wrap ValueErrors and
allow
them to escape
---------------------------------------------------+------------------------
Reporter: Leo | Owner: Leo
Status: assigned | Milestone: 1.3
Component: Database layer (models, ORM) | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 1 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Comment (by Leo):
timo, thanks for pointing that out. r13751 fixes the initial problem that
I posted, however it changes the behavior of the to_python function in the
same way as my proposed patch - which means that according to the
discussion in this ticket it requires the same backwards incompatible
documentation. Code that caught `ValueError` on that field before will now
not catch it.
The patch for this ticket makes the same fix across several other models
and makes the API here consistent. @kmtracey, I don't think that there's a
backward compatible solution here, precisely because it's trying to fix
behavior that's broken. Having ValidationError extend from ValueError is a
bad idea that's going to affect a LOT more of the codebase and client
code.
@lukeplant all of the test changes were necessary because the tests were
testing the broken API, just like they were in r13751. The expected
exception is a `ValidationError` not a `ValueError`.
I will spend time this week to add a note to the backwards compatibility
for this patch. Hopefully it's not too late for 1.3.
--
Ticket URL: <http://code.djangoproject.com/ticket/11716#comment:31>
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.