Opened 19 years ago

Closed 18 years ago

Last modified 18 years ago

#1415 closed defect (invalid)

magic-removal .. user object not working correctly

Reported by: Ian@… Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

same for mod_python.

Request Method: GET
Request URL: http://localhost:8080/admin/
Exception Type: AttributeError
Exception Value: 'WSGIRequest' object has no attribute '_user_source'
Exception Location: /src/django_src/django/core/handlers/wsgi.py in _get_user, line 123

Change History (10)

comment:1 by ian@…, 19 years ago

Resolution: invalid
Status: newclosed

akaihola solved it..
needed to add some new middleware

comment:2 by anonymous, 19 years ago

Component: Admin interfaceCore framework
Resolution: invalid
Status: closedreopened

Anyway to find a solution for this?
Thx.

comment:3 by Malcolm Tredinnick <malcolm@…>, 19 years ago

Resolution: fixed
Status: reopenedclosed

The solution is to add

"django.contrib.auth.middleware.RequestUserMiddleware"

to your MIDDLEWARE_CLASSES tuple in settings.py.

comment:4 by anonymous, 19 years ago

manage.py startapp generation is broken in this regard (misses this entry).

comment:5 by anonymous, 19 years ago

Resolution: fixed
Status: closedreopened

The suggested bugfix did not work for me in svn r2883, the same error message keep occurring. Does not work with mod_python, apache-proxy or direct requests to the Django webserver.

comment:6 by Malcolm Tredinnick <malcolm@…>, 19 years ago

Can you please provide more information about the error you are seeing (traceback details). Version 2883 of the code does not contain _user_source anywhere, so you are not seeing the same bug as originally reported.

comment:7 by Antonio Cavedoni, 18 years ago

I used to have the same problem, until I read this: It used to be set in the mod_python and wsgi handlers. You will need to add "django.contrib.auth.middleware.AuthenticationMiddleware" somewhere after "django.contrib.sessions.middleware.SessionMiddleware" in MIDDLEWARE_CLASSES in your settings.py file. Otherwise accessing request.user will raise an AttributeError.

Could this be it?

comment:8 by Adrian Holovaty, 18 years ago

Resolution: invalid
Status: reopenedclosed

Looks like that was the problem. (See last comment.)

comment:9 by anonymous, 18 years ago

Resolution: invalid
Status: closedreopened

I just ran into this with a fresh svn checkout, I think manage.py startapp should be fixed.

comment:10 by Adrian Holovaty, 18 years ago

Resolution: invalid
Status: reopenedclosed

See the previous comments for the solution to the problem.

Note: See TracTickets for help on using tickets.
Back to Top