When the 'path.to.view' cannot be imported, it raises ModuleNotFoundError,
as seen in this Stack Overflow question
https://stackoverflow.com/q/55481810/113962
I suggest we catch the ModuleNotFoundError, and add another check code,
e.g.
* **urls.E008**: The custom ``handlerXXX`` view ``'path.to.view'`` cannot
be imported.
--
Ticket URL: <https://code.djangoproject.com/ticket/30318>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Alasdair Nicol
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/30318#comment:1>
* type: Uncategorized => Bug
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
Comment:
Hi Alasdair,
Thanks for the report, and the effort on StackOverflow. I'm happy to take
this as improvement on the system check for 2.2.1. (Yes, catching an
incorrect path is probably worthwhile.)
--
Ticket URL: <https://code.djangoproject.com/ticket/30318#comment:2>
Old description:
> #29642 added checks for the signatures of custom error handlers.
>
> When the 'path.to.view' cannot be imported, it raises
> ModuleNotFoundError, as seen in this Stack Overflow question
>
> https://stackoverflow.com/q/55481810/113962
>
> I suggest we catch the ModuleNotFoundError, and add another check code,
> e.g.
>
> * **urls.E008**: The custom ``handlerXXX`` view ``'path.to.view'`` cannot
> be imported.
New description:
#29642 added checks for the signatures of custom error handlers.
When the 'path.to.view' cannot be imported, it raises ModuleNotFoundError
or ViewDoesNotExist, as seen in this Stack Overflow question:
https://stackoverflow.com/q/55481810/113962
I suggest we catch the exception, and add another check code, e.g.
{{{
* **urls.E008**: The custom ``handlerXXX`` view ``'path.to.view'`` cannot
be imported.
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/30318#comment:3>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/30318#comment:4>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/30318#comment:5>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/30318#comment:6>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/30318#comment:7>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"a5accc0368c6575b55976c06af36ed399c85c781" a5accc0]:
{{{
#!CommitTicketReference repository=""
revision="a5accc0368c6575b55976c06af36ed399c85c781"
Fixed #30318 -- Added check for importability of arguments of custom error
handler views.
Thanks to Jon on Stack Overflow for reporting the issue.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30318#comment:8>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"3c3df7db8e5ce7882d6a8379fc2d0f82330114f1" 3c3df7db]:
{{{
#!CommitTicketReference repository=""
revision="3c3df7db8e5ce7882d6a8379fc2d0f82330114f1"
[2.2.x] Fixed #30318 -- Added check for importability of arguments of
custom error handler views.
Thanks to Jon on Stack Overflow for reporting the issue.
Backport of a5accc0368c6575b55976c06af36ed399c85c781 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30318#comment:9>