﻿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
15343	import of handler500 is missing in django/contrib/auth/tests/urls.py	Marco De Paoli	nobody	"as documented here [http://code.djangoproject.com/ticket/11013#comment:1]
[[BR]]
all urls files must contain
{{{
from django.conf.urls.defaults import *
}}}
or an explicit import for the function handler404 and handler500 ex.
{{{
from django.conf.urls.defaults import handler404, handler500
}}}

but the file django/contrib/auth/tests/urls.py doesn't follow this rule[[BR]]

the consequence is that any problem that arise inside auth tests is signaled as
{{{
AttributeError: 'module' object has no attribute 'handler500'
}}}

as a temporary workaround I used this method:
 * modify django/contrib/auth/tests/urls.py to add an explict import for handler500
 * run auth test cases and obtain the correct error message
 * restore django/contrib/auth/tests/urls.py

Nevertheless this case shows another problem

When Django outputs:
{{{
AttributeError: 'module' object has no attribute 'handler500'
}}}

it doesn't signal ''which'' file is missing handler500, and this makes the research a little bit hard

My advice is to modify slightly the urlresolver mechanism (django/core/urlresolvers.py)[[BR]]

for example the instruction
{{{
callback = getattr(self.urlconf_module, 'handler%s' % view_type)
}}}
could be enveloped inside a try/except block that rises an exception with self.urlconf_module string in it"		closed	Contrib apps	1.2		fixed	urls handler500	Marco De Paoli afitzpatrick	Unreviewed	0	0	0	0	0	0
