Opened 13 years ago
Closed 13 years ago
#16573 closed Bug (fixed)
admindocs "views" view returns no urls
Reported by: | Ryan Lopopolo | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admindocs | Version: | dev |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The conditions in the if in extract_views_from_url patterns are in the wrong order. This results in all of my root level urls matching a nil view function. Swapping the if and elif conditions fixes the problem
Diff is attached.
Attachments (1)
Change History (7)
by , 13 years ago
Attachment: | extract_views_from_urlpatterns_diff.txt added |
---|
comment:1 by , 13 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
You lost me at:
This results in all of my root level urls matching a nil view function.
What's a "nil view function"?
More generally, what's the problem and how do I reproduce it? What's the expected result, and the actual result?
comment:2 by , 13 years ago
Resolution: | needsinfo |
---|---|
Status: | closed → reopened |
When visiting /admin/doc/views
Instead of building a list of all of the functions defined in my apps' views and their associated urls,
the function extract_views_from_url_patterns returns a list of tuples of the form
(None, <url from root level urls.py>)
For example:
(None, "admin/doc/"),
(None, "admin/"),
(None, "myapp/")
To reproduce, visit http://somedjangosite.com/admin/doc/views
comment:3 by , 13 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
When I visit that URL on my projects, I get a listing of my URLs and views, as expected.
We need more information to reproduce your problem. For instance, could you build a minimal project that exhibits the issue?
comment:4 by , 13 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
This django project, which uses a recent version of trunk exhibits the error: https://github.com/lopopolo/hyperbola
Visiting http://localhost/ssb/doc/views when running the development server should exhibit the problem
comment:5 by , 13 years ago
Needs tests: | set |
---|---|
Severity: | Normal → Release blocker |
Triage Stage: | Unreviewed → Accepted |
Good catch. This is a regression introduced at r16405.
With a checkout of your project (but that project has nothing special, the result would be the same with any Django site), and r16404 of Django, it works.
With r16405, I get this exception:
Environment: Request Method: GET Request URL: http://localhost:8000/ssb/doc/views/ Django Version: 1.4 pre-alpha SVN-16405 Python Version: 2.6.6 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.markup', 'hyperbola.contact', 'hyperbola.frontpage', 'hyperbola.lifestream', 'hyperbola.helpers'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware') Traceback: File "/Users/myk/Desktop/hyperbola/hyperbola/django/core/handlers/base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) File "/Users/myk/Desktop/hyperbola/hyperbola/django/contrib/admin/views/decorators.py" in _checklogin 16. return view_func(request, *args, **kwargs) File "/Users/myk/Desktop/hyperbola/hyperbola/django/contrib/admindocs/views.py" in view_index 137. 'module': func.__module__, Exception Type: AttributeError at /ssb/doc/views/ Exception Value: 'NoneType' object has no attribute '__module__'
git diff of proposed fix