Code

Opened 8 years ago

Closed 8 years ago

#2396 closed defect (fixed)

Cache change fails under fcgi

Reported by: Kevin Owned by: jacob
Component: Core (Cache system) 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

Running under lighttpd and fcgi, new setting CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True leads to..

2006-07-22 09:24:04: (mod_fastcgi.c.2536) FastCGI-stderr: Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/flup/server/fcgi_base.py", line 556, in run

protocolStatus, appStatus = self.server.handler(self)

File "/usr/lib/python2.4/site-packages/flup/server/fcgi_base.py", line 1086, in handler

result = self.application(environ, start_response)

File "/usr/lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 148, in call

response = self.get_response(request.path, request)

File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py", line 59, in get_response

response = middleware_method(request)

File "/usr/lib/python2.4/site-packages/django/middleware/cache.py", line 49, in process_request

if self.cache_anonymous_only and request.user.is_authenticated():

AttributeError: 'WSGIRequest' object has no attribute 'user'

2006-07-22 09:24:04: (mod_fastcgi.c.2536) FastCGI-stderr:

Attachments (0)

Change History (1)

comment:1 Changed 8 years ago by ian@…

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

I had the same problem.
the 'fix' is to move the cachemiddleware setting to AFTER the user setting
ala

MIDDLEWARE_CLASSES = (
    ...
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    'django.middleware.cache.CacheMiddleware',
    ...
)

It works great too!

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.