changeset 4246:44b5548fe213

Eliminated legacy _cache_disabled property
author Florian Krupicka <florian.krupicka@googlemail.com>
date Thu, 24 Jul 2008 21:15:14 +0200
parents 2b21ec54a5c9
children ac631e6b2718
files MoinMoin/web/contexts.py
diffstat 1 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/web/contexts.py	Thu Jul 24 20:38:10 2008 +0200
+++ b/MoinMoin/web/contexts.py	Thu Jul 24 21:15:14 2008 +0200
@@ -147,7 +147,6 @@
     session = EnvironProxy('session')
 
     _auth_redirected = EnvironProxy('old._auth_redirected', 0)
-    _cache_disabled = EnvironProxy('old._cache_disabled', 0)
     cacheable = EnvironProxy('old.cacheable', 0)
 
     class _proxy(property):
@@ -200,20 +199,15 @@
         self.headers.add(header, value)
 
     def disableHttpCaching(self, level=1):
-        if level <= self._cache_disabled:
+        if level == 1 and self.headers.get('Pragma') == 'no-cache':
             return
 
         if level == 1:
-            self.headers.add('Cache-Control', 'private, must-revalidate, mag-age=10')
+            self.headers.set('Cache-Control', 'private, must-revalidate, mag-age=10')
         elif level == 2:
-            self.headers.add('Cache-Control', 'no-cache')
+            self.headers.set('Cache-Control', 'no-cache')
             self.headers.set('Pragma', 'no-cache')
-
-        if not self._cache_disabled:
-            when = time.time() - (3600 * 24 * 365)
-            self.headers.set('Expires', http_date(when))
-
-        self._cache_disabled = level
+        self.request.expires = time.time() - 3600 * 24 * 365
 
     def isSpiderAgent(self):
         return check_spider(self.request.user_agent, self.cfg)