Ticket #2541: django-middleware-cache.diff

File django-middleware-cache.diff, 804 bytes (added by anonymou, 9 years ago)
  • django/middleware/cache.py

     
    4141
    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 requires authentication middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.auth.middleware.AuthenticationMiddleware'."
     46
    4447        if not request.method in ('GET', 'HEAD') or request.GET:
    4548            request._cache_update_cache = False
    4649            return None # Don't bother checking the cache.
Back to Top