[Django] #28507: Allow ValidationErrors to equal each other when created identically

13 views
Skip to first unread message

Django

unread,
Aug 18, 2017, 1:04:45 PM8/18/17
to django-...@googlegroups.com
#28507: Allow ValidationErrors to equal each other when created identically
----------------------------------------+---------------------------------
Reporter: kamni | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.11
Severity: Normal | Keywords: ValidationError
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------------------------+---------------------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/28507>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 18, 2017, 1:08:17 PM8/18/17
to django-...@googlegroups.com
#28507: Allow ValidationErrors to equal each other when created identically
---------------------------------+--------------------------------------

Reporter: kamni | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.11
Severity: Normal | Resolution:

Keywords: ValidationError | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Description changed by kamni:

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>

Django

unread,
Aug 18, 2017, 2:30:46 PM8/18/17
to django-...@googlegroups.com
#28507: Allow ValidationErrors to equal each other when created identically
---------------------------------+------------------------------------

Reporter: kamni | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.11
Severity: Normal | Resolution:
Keywords: ValidationError | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Markus Holtermann):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:2>

Django

unread,
Aug 18, 2017, 2:47:40 PM8/18/17
to django-...@googlegroups.com
#28507: Allow ValidationErrors to equal each other when created identically
---------------------------------+------------------------------------

Reporter: kamni | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.11
Severity: Normal | Resolution:
Keywords: ValidationError | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

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>

Django

unread,
Aug 24, 2017, 12:18:41 AM8/24/17
to django-...@googlegroups.com
#28507: Allow ValidationErrors to equal each other when created identically
---------------------------------+---------------------------------------
Reporter: kamni | Owner: caleb logan
Type: New feature | Status: assigned

Component: Core (Other) | Version: 1.11
Severity: Normal | Resolution:
Keywords: ValidationError | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+---------------------------------------
Changes (by caleb logan):

* status: new => assigned
* owner: nobody => caleb logan


--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:4>

Django

unread,
Mar 21, 2019, 2:47:15 PM3/21/19
to django-...@googlegroups.com
#28507: Allow ValidationErrors to equal each other when created identically
---------------------------------+---------------------------------------
Reporter: kamni | Owner: caleb logan
Type: New feature | Status: assigned
Component: Core (Other) | Version: 1.11
Severity: Normal | Resolution:
Keywords: ValidationError | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
---------------------------------+---------------------------------------
Changes (by felixxm):

* 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>

Django

unread,
Jul 21, 2020, 3:56:49 PM7/21/20
to django-...@googlegroups.com
#28507: Allow ValidationErrors to equal each other when created identically
---------------------------------+---------------------------------------
Reporter: kamni | Owner: David Smith

Type: New feature | Status: assigned
Component: Core (Other) | Version: 1.11
Severity: Normal | Resolution:
Keywords: ValidationError | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+---------------------------------------
Changes (by David Smith):

* owner: caleb logan => David Smith
* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:6>

Django

unread,
Jul 22, 2020, 2:13:27 AM7/22/20
to django-...@googlegroups.com
#28507: Allow ValidationErrors to equal each other when created identically
---------------------------------+---------------------------------------
Reporter: kamni | Owner: David Smith
Type: New feature | Status: assigned
Component: Core (Other) | Version: 1.11
Severity: Normal | Resolution:
Keywords: ValidationError | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
---------------------------------+---------------------------------------
Changes (by felixxm):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:7>

Django

unread,
Jul 23, 2020, 6:31:07 AM7/23/20
to django-...@googlegroups.com
#28507: Allow ValidationErrors to equal each other when created identically
-------------------------------------+-------------------------------------

Reporter: kamni | Owner: David
| Smith
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: ValidationError | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* needs_better_patch: 1 => 0
* version: 1.11 => master
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/28507#comment:8>

Django

unread,
Jul 29, 2020, 6:51:56 AM7/29/20
to django-...@googlegroups.com
#28507: Allow ValidationErrors to equal each other when created identically
-------------------------------------+-------------------------------------
Reporter: kamni | Owner: David
| Smith
Type: New feature | Status: closed

Component: Core (Other) | Version: master
Severity: Normal | Resolution: fixed

Keywords: ValidationError | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* 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>

Django

unread,
Oct 5, 2020, 3:14:14 PM10/5/20
to django-...@googlegroups.com
#28507: Allow ValidationErrors to equal each other when created identically
-------------------------------------+-------------------------------------
Reporter: kamni | Owner: David
| Smith
Type: New feature | Status: closed
Component: Core (Other) | Version: master
Severity: Normal | Resolution: fixed
Keywords: ValidationError | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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>

Reply all
Reply to author
Forward
0 new messages