urlresolvers.get_callable() need to present the inner exception if any
|Reported by:||fangsboyfriend@…||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When I start a django project with command 'manage.py runserver'
I got the following exception; I feel so puzzled about it. In fact, the view really exist. Why it say no?
Traceback (most recent call last): File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 101, i n get_response request.path_info) File "C:\Python27\lib\site-packages\django\core\urlresolvers.py", line 303, in resolve sub_match = pattern.resolve(new_path) File "C:\Python27\lib\site-packages\django\core\urlresolvers.py", line 212, in resolve return ResolverMatch(self.callback, args, kwargs, self.name) File "C:\Python27\lib\site-packages\django\core\urlresolvers.py", line 219, in callback self._callback = get_callable(self._callback_str) File "C:\Python27\lib\site-packages\django\utils\functional.py", line 27, in w rapper result = func(*args) File "C:\Python27\lib\site-packages\django\core\urlresolvers.py", line 104, in get_callable (lookup_view, mod_name)) ViewDoesNotExist: Could not import desktop.desktop_views.portal. View does not exist in module desktop.desktop_views.
After reading the source code [line 101, urlresolvers.py], I found that the root reason is the 'AttributeError'.
except AttributeError: if not can_fail: raise ViewDoesNotExist( "Could not import %s. View does not exist in module %s." % (lookup_view, mod_name))
So I suggest to add the details of AttributeError within the final ViewDoesNotExist exception. It would make the diagnosis more easier.
Change History (4)
comment:1 Changed 2 years ago by Jacky
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset