[patch] Bad URLPattern results in potentially misleading exception
|Reported by:||Matt McClanahan <cardinal@…>||Owned by:||adrian|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
In django/core/urlresolvers.py, get_mod_func() raises a ValueError exception if the callback does not contain any dots. This rare situation is almost certainly caused by the user specifying the view callback incorrectly (E.g, 'edit_object' instead of 'myproject.myapp.views.edit_object')
To clarify the cause of the error, this patch makes get_mod_func() return the full callback string as the module name and a blank function name. The calling functions then raise either a ViewDoesNotExist, or in the case of RegexURLPattern.reverse(), a NoReverseMatch.
While this bug only affects the URL which was specified incorrectly in the app/project it belongs to, it also has the slightly more serious effect of completely breaking the admin's view documentation.