﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32260	handler500 as a Class-based view raises SystemCheckError	Daniyal Abbasi	Daniyal Abbasi	"Setting handler500 as a Class-Based view raises the following error which running checks.


{{{
$ python manage.py check
SystemCheckError: System check identified some issues:

ERRORS:
?: (urls.E007) The custom handler500 view 'path.to.my.MyView' does not take the correct number of arguments (request).
}}}

In my root urls.py, I have the following configuration,

{{{
handler404 = MyView.as_view()
handler500 = MyView.as_view()
}}}


I believe this is due to the function `_check_custom_error_handlers` in `django/urls/resolver.py`. The signature variable in this function is expected to match (request, exception) for all handlers except for handler500 which is expected to have only (request). A positional argument, template_name is also present. 

While using class based views, we get two positional arguments (self, request) and then it recieves *args and * *kwargs. The check is permitting other handlers as the number of arguments coincidentally match. 

I suggest a fix in the `_check_custom_error_handlers` which first checks if the handler* are function based or class based, and then it preceed the check with the appropriate number of arguments. 
"	Cleanup/optimization	closed	Core (System checks)	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
