[Django] #30318: Add new system check message when 'path.to.view' is cannot be imported

13 views
Skip to first unread message

Django

unread,
Apr 3, 2019, 5:40:38 AM4/3/19
to django-...@googlegroups.com
#30318: Add new system check message when 'path.to.view' is cannot be imported
------------------------------------------------+------------------------
Reporter: Alasdair Nicol | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (System checks) | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
#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.

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

Django

unread,
Apr 3, 2019, 5:40:52 AM4/3/19
to django-...@googlegroups.com
#30318: Add new system check message when 'path.to.view' is cannot be imported
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: Alasdair
| Nicol
Type: Uncategorized | Status: assigned
Component: Core (System | Version: 2.2
checks) |
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Alasdair Nicol):

* owner: nobody => Alasdair Nicol
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/30318#comment:1>

Django

unread,
Apr 3, 2019, 5:55:02 AM4/3/19
to django-...@googlegroups.com
#30318: Add new system check message when 'path.to.view' is cannot be imported
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: Alasdair
| Nicol
Type: Bug | Status: assigned

Component: Core (System | Version: 2.2
checks) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

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

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

Django

unread,
Apr 3, 2019, 7:25:02 PM4/3/19
to django-...@googlegroups.com
#30318: Add new system check message when custom error handler 'path.to.view'

cannot be imported
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: Alasdair
| Nicol
Type: Bug | Status: assigned
Component: Core (System | Version: 2.2
checks) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Alasdair Nicol:

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>

Django

unread,
Apr 3, 2019, 7:37:11 PM4/3/19
to django-...@googlegroups.com
#30318: Add new system check message when custom error handler 'path.to.view'
cannot be imported
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: Alasdair
| Nicol
Type: Bug | Status: assigned
Component: Core (System | Version: 2.2
checks) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


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

Django

unread,
Apr 8, 2019, 5:03:35 AM4/8/19
to django-...@googlegroups.com
#30318: Add new system check message when custom error handler 'path.to.view'
cannot be imported
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: Alasdair
| Nicol
Type: Bug | Status: assigned
Component: Core (System | Version: 2.2
checks) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/30318#comment:5>

Django

unread,
Apr 8, 2019, 6:33:04 PM4/8/19
to django-...@googlegroups.com
#30318: Add new system check message when custom error handler 'path.to.view'
cannot be imported
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: Alasdair
| Nicol
Type: Bug | Status: assigned
Component: Core (System | Version: 2.2
checks) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* needs_better_patch: 1 => 0


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

Django

unread,
Apr 25, 2019, 4:46:45 AM4/25/19
to django-...@googlegroups.com
#30318: Add new system check message when custom error handler 'path.to.view'
cannot be imported
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: Alasdair
| Nicol
Type: Bug | Status: assigned
Component: Core (System | Version: 2.2
checks) |
Severity: Release blocker | Resolution:
Keywords: | 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):

* stage: Accepted => Ready for checkin


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

Django

unread,
Apr 25, 2019, 5:39:02 AM4/25/19
to django-...@googlegroups.com
#30318: Add new system check message when custom error handler 'path.to.view'
cannot be imported
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: Alasdair
| Nicol
Type: Bug | Status: closed

Component: Core (System | Version: 2.2
checks) |
Severity: Release blocker | Resolution: fixed

Keywords: | 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:"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>

Django

unread,
Apr 25, 2019, 5:39:30 AM4/25/19
to django-...@googlegroups.com
#30318: Add new system check message when custom error handler 'path.to.view'
cannot be imported
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: Alasdair
| Nicol
Type: Bug | Status: closed
Component: Core (System | Version: 2.2
checks) |
Severity: Release blocker | Resolution: fixed
Keywords: | 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:"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>

Reply all
Reply to author
Forward
0 new messages