Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#1415 closed defect (invalid)

magic-removal .. user object not working correctly

Reported by: Ian@… Owned by: adrian
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: UI/UX:

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 Changed 9 years ago by ian@…

  • Resolution set to invalid
  • Status changed from new to closed

akaihola solved it..
needed to add some new middleware

comment:2 Changed 9 years ago by anonymous

  • Component changed from Admin interface to Core framework
  • Resolution invalid deleted
  • Status changed from closed to reopened

Anyway to find a solution for this?
Thx.

comment:3 Changed 9 years ago by Malcolm Tredinnick <malcolm@…>

  • Resolution set to fixed
  • Status changed from reopened to closed

The solution is to add

"django.contrib.auth.middleware.RequestUserMiddleware"

to your MIDDLEWARE_CLASSES tuple in settings.py.

comment:4 Changed 9 years ago by anonymous

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

comment:5 Changed 9 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

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 Changed 9 years ago by Malcolm Tredinnick <malcolm@…>

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 Changed 9 years ago by verbosus

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 Changed 9 years ago by adrian

  • Resolution set to invalid
  • Status changed from reopened to closed

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

comment:9 Changed 9 years ago by anonymous

  • Resolution invalid deleted
  • Status changed from closed to reopened

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

comment:10 Changed 9 years ago by adrian

  • Resolution set to invalid
  • Status changed from reopened to closed

See the previous comments for the solution to the problem.

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