--
Ticket URL: <https://code.djangoproject.com/ticket/23976>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> Redefinition variable message by django/django/core/exceptions.py
> line 114, for message in message:
New description:
Redefinition variable message by django/django/core/exceptions.py
line 114, for message in message:
below line, 116:
{{{
if not isinstance(message, ValidationError):
message = ValidationError(message)
self.error_list.extend(message.error_list)
}}}
if message isinstance of dict: AttributeError: 'ValidationError' object
has no attribute 'error_list'
--
--
Ticket URL: <https://code.djangoproject.com/ticket/23976#comment:1>
Comment (by timgraham):
Could you provide the code to reproduce the error?
--
Ticket URL: <https://code.djangoproject.com/ticket/23976#comment:2>
Comment (by archivarius888):
{{{
>>> from django.core.exceptions import ValidationError
>>> ValidationError([{}])
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23976#comment:3>
Comment (by whoshuu):
Under what circumstances does this exception get thrown? From the
definition of `message`, it doesn't appear that `[{}]` is a valid form of
`message`. If `message` does take that form somehow, then that's a
separate bug.
--
Ticket URL: <https://code.djangoproject.com/ticket/23976#comment:4>
Comment (by archivarius888):
Yeap, I just code would be better. And the user can do anything.
--
Ticket URL: <https://code.djangoproject.com/ticket/23976#comment:5>
* component: Core (Serialization) => Core (Other)
* stage: Unreviewed => Accepted
* type: Bug => Cleanup/optimization
* severity: Release blocker => Normal
Comment:
We could at least not crash so obscurely I suppose.
--
Ticket URL: <https://code.djangoproject.com/ticket/23976#comment:6>
Comment (by takis):
Could not reproduce using current Django master on Python 3.4.1 on OSX
10.10.4.
--
Ticket URL: <https://code.djangoproject.com/ticket/23976#comment:7>
Comment (by Adam Zapletal):
I've confirmed that the crash no longer happens on both `v2.0.7` and
`master` on Mac OS 10.13.5 with Python 3.7.0:
{{{
In [1]: import django
In [2]: django.__version__
Out[2]: '2.0.7'
In [3]: from django.core.exceptions import ValidationError
In [4]: ValidationError([{}])
Out[4]: ValidationError([])
}}}
{{{
In [1]: import django
In [2]: django.__version__
Out[2]: '2.2.dev20180711212029'
In [3]: from django.core.exceptions import ValidationError
In [4]: ValidationError([{}])
Out[4]: ValidationError([])
}}}
Can this ticket be closed?
--
Ticket URL: <https://code.djangoproject.com/ticket/23976#comment:8>
* status: new => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/23976#comment:9>