'WSGIRequest' object has no attribute 'user' #2744

Closed
worseisbetter opened this Issue Feb 27, 2014 · 4 comments

Comments

Projects
None yet
2 participants
@ghost

ghost commented Feb 27, 2014

404's will throw this error:

Internal Server Error: /xxx
Traceback (most recent call last):
File "/virtualenvs/xxx/lib/python2.7/site-packages/django/core/handlers/base.py", line 201, in get_response
response = middleware_method(request, response)
File "/virtualenvs/xxx/src/django-cms/cms/middleware/toolbar.py", line 88, in process_response
if request.user.is_staff:
AttributeError: 'WSGIRequest' object has no attribute 'user'

@digi604 digi604 added the blocker label Feb 27, 2014

@digi604 digi604 added this to the 3.0 milestone Feb 27, 2014

@digi604 digi604 self-assigned this Feb 27, 2014

@digi604

This comment has been minimized.

Show comment Hide comment
@digi604

digi604 Feb 27, 2014

Contributor

I can not reproduce this error.... why is there no user object on the request?

Contributor

digi604 commented Feb 27, 2014

I can not reproduce this error.... why is there no user object on the request?

digi604 added a commit to digi604/django-cms that referenced this issue Feb 27, 2014

@digi604 digi604 referenced this issue Feb 27, 2014

Merged

fix #2744 #2750

@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Feb 27, 2014

seems to be the something with APPEND_SLASH, should be the same bug like this.
https://github.com/django-debug-toolbar/django-debug-toolbar/issues/399

ghost commented Feb 27, 2014

seems to be the something with APPEND_SLASH, should be the same bug like this.
https://github.com/django-debug-toolbar/django-debug-toolbar/issues/399

@digi604

This comment has been minimized.

Show comment Hide comment
@digi604

digi604 Feb 27, 2014

Contributor

APPEND_SLASH = False and debug_toolbar installed.... still not able to reproduce.

Contributor

digi604 commented Feb 27, 2014

APPEND_SLASH = False and debug_toolbar installed.... still not able to reproduce.

@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Feb 27, 2014

the problem is with django 1.6.x:

During the response phases (process_response() and process_exception() middleware), the classes are applied in reverse order, from the bottom up

So it has to do with APPEND_SLASH being applied with via a redirect by Django Common Middleware, preventing the process_request() in AuthenticationMiddleware (which adds the user attribute) from being run but your process_response still being run.

http://stackoverflow.com/questions/11223597/django-wsgirequest-object-has-no-attribute-user-on-some-pages/14793959#14793959

ghost commented Feb 27, 2014

the problem is with django 1.6.x:

During the response phases (process_response() and process_exception() middleware), the classes are applied in reverse order, from the bottom up

So it has to do with APPEND_SLASH being applied with via a redirect by Django Common Middleware, preventing the process_request() in AuthenticationMiddleware (which adds the user attribute) from being run but your process_response still being run.

http://stackoverflow.com/questions/11223597/django-wsgirequest-object-has-no-attribute-user-on-some-pages/14793959#14793959

tanderegg added a commit to tanderegg/django-cms that referenced this issue Feb 27, 2014

@digi604 digi604 closed this in #2750 Feb 28, 2014

digi604 added a commit that referenced this issue Feb 28, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment