--
Ticket URL: <https://code.djangoproject.com/ticket/28507>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> Currently ValidationErrors (`django.core.exceptions.ValidationError`)
> that have identical `messages` don't equal each other, which is counter-
> intuitive, and can make certain kinds of testing more complicated. Please
> add an `__eq__` method that allows two ValidationErrors to be compared.
New description:
Currently ValidationErrors (`django.core.exceptions.ValidationError`) that
have identical `messages` don't equal each other, which is counter-
intuitive, and can make certain kinds of testing more complicated. Please
add an `__eq__` method that allows two ValidationErrors to be compared.
Ideally, this would be more than just a simple `self.messages ==
other.messages`. It would be most helpful if the comparison were
independent of the order in which errors were raised in a field or in
`non_field_errors`.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:2>
Comment (by Markus Holtermann):
I probably wouldn't want to limit the comparison to an error's message but
rather to its full set of attributes (`message`, `code`, `params`). While
`params` is always pushed into `message` when iterating over the errors in
an `ValidationError`, I believe it can be beneficial to know if the params
that were put inside are the same.
--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:3>
* status: new => assigned
* owner: nobody => caleb logan
--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:4>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/8978 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:5>
* owner: caleb logan => David Smith
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:6>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:7>
* needs_better_patch: 1 => 0
* version: 1.11 => master
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"95da207bdb7550922781bbdb3a7b993db0dfc4cf" 95da207]:
{{{
#!CommitTicketReference repository=""
revision="95da207bdb7550922781bbdb3a7b993db0dfc4cf"
Fixed #28507 -- Made ValidationError.__eq__() ignore messages and params
ordering.
Co-authored-by: caleb logan <clog...@gmail.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:9>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"4c675523bd3e45906bf6736444c65b066e25208c" 4c67552]:
{{{
#!CommitTicketReference repository=""
revision="4c675523bd3e45906bf6736444c65b066e25208c"
Refs #29838, Refs #28507 -- Made make_hashable() ignore key order.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:10>