Django

Code

Changeset 3603

Show
Ignore:
Timestamp:
08/17/06 22:31:13 (2 years ago)
Author:
adrian
Message:

Fixed #2541 -- Added helpful error message for CacheMiddleware? in the case of CACHE_ANONYMOUS_ONLY=True and uninstalled/unordered AuthenticationMiddleware?. Thanks, dummy@habmalnefrage.de

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/middleware/cache.py

    r3414 r3603  
    4242    def process_request(self, request): 
    4343        "Checks whether the page is already cached and returns the cached version if available." 
     44        if self.cache_anonymous_only: 
     45            assert hasattr(request, 'user'), "The Django cache middleware with CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True requires authentication middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.auth.middleware.AuthenticationMiddleware' before the CacheMiddleware." 
     46 
    4447        if not request.method in ('GET', 'HEAD') or request.GET: 
    4548            request._cache_update_cache = False