Opened 15 years ago
Closed 14 years ago
#14506 closed Bug (fixed)
Crash on HEAD request
| Reported by: | azurit | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 1.2 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py", line 94, in get_response
response = middleware_method(request, callback, callback_args, callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/middleware/doc.py", line 15, in process_view
if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or (request.user.is_authenticated() and request.user.is_staff)):
AttributeError: 'WSGIRequest' object has no attribute 'user'
Attachments (2)
Change History (14)
comment:1 by , 15 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 15 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
Please give us more information on how to reproduce. Also try a newer django version.
follow-up: 4 comment:3 by , 15 years ago
Looks like request.user is not set. Which means the Auth middleware was not successfully run.
follow-up: 6 comment:4 by , 15 years ago
Replying to jezdez:
Looks like request.user is not set. Which means the Auth middleware was not successfully run.
Yes, Auth middleware is NOT loaded.
comment:5 by , 15 years ago
| Resolution: | invalid |
|---|---|
| Status: | closed → reopened |
follow-up: 7 comment:6 by , 15 years ago
Replying to azurit:
Replying to jezdez:
Looks like request.user is not set. Which means the Auth middleware was not successfully run.
Yes, Auth middleware is NOT loaded.
If you don't have the auth middleware loaded, why do you have the XView middleware loaded (that's the code that is generating the exception)? That middleware is documented (http://docs.djangoproject.com/en/dev/ref/middleware/#django.middleware.doc.django.middleware.doc.XViewMiddleware) as providing some function for the admindocs feature, which is only accessible from admin, which requires the auth middleware to be in place. So XView assumes auth middleware is loaded.
Leaving open since I guess the XView code could handle this more gracefully, but the easiest fix would seem to be for you to remove it from your middleware setting.
comment:7 by , 15 years ago
Replying to kmtracey:
Replying to azurit:
Replying to jezdez:
Looks like request.user is not set. Which means the Auth middleware was not successfully run.
Yes, Auth middleware is NOT loaded.
If you don't have the auth middleware loaded, why do you have the XView middleware loaded (that's the code that is generating the exception)? That middleware is documented (http://docs.djangoproject.com/en/dev/ref/middleware/#django.middleware.doc.django.middleware.doc.XViewMiddleware) as providing some function for the admindocs feature, which is only accessible from admin, which requires the auth middleware to be in place. So XView assumes auth middleware is loaded.
Leaving open since I guess the XView code could handle this more gracefully, but the easiest fix would seem to be for you to remove it from your middleware setting.
Thank you, i removed XView middleware. Maybe documentation should mention that XView depends on Auth ?
comment:8 by , 15 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
by , 15 years ago
Assert the right middleware is running similar to contrib.auth.middleware
by , 15 years ago
Added dependency description to the docs (I'm not too sure on the format, so please test first)
comment:9 by , 15 years ago
| Severity: | → Normal |
|---|---|
| Type: | → Bug |
comment:10 by , 14 years ago
| Component: | Uncategorized → Documentation |
|---|---|
| Easy pickings: | unset |
| UI/UX: | unset |
comment:11 by , 14 years ago
| Has patch: | set |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
Patch still applies cleanly to trunk.
Reformatted, please use the preview button in the future.