Hopefully fix json caching issues in IE7.
authorPawel Solyga <Pawel.Solyga@gmail.com>
Sun, 15 Feb 2009 18:50:13 +0000
changeset 1349 d05a9bf08c11
parent 1348 8e3bd495729f
child 1350 c822368a60b1
Hopefully fix json caching issues in IE7. Will wait for Lennie to confirm if it works correctly now. Patch by: Pawel Solyga Review by: to-be-reviewed
app/soc/views/models/base.py
app/soc/views/models/org_app.py
--- a/app/soc/views/models/base.py	Sun Feb 15 16:11:47 2009 +0000
+++ b/app/soc/views/models/base.py	Sun Feb 15 18:50:13 2009 +0000
@@ -35,6 +35,7 @@
 from soc.views.helper import decorators
 from soc.views.helper import forms
 from soc.views.helper import redirects
+from soc.views.helper import responses
 from soc.views import sitemap
 
 import soc.logic
@@ -623,9 +624,12 @@
     template = 'soc/json.html'
 
     response = responses.respond(request, template, context)
-    # TODO IE7 seems to ignore the headers
+    # if the browser supports HTTP/1.1
+    # post-check and pre-check and no-store for IE7
+    response['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'
+    # if the browser supports HTTP/1.0
     response['Pragma'] = 'no-cache'
-    response['Cache-Control'] = 'no-cache, must-revalidate'
+    
     return response
 
   def _editPost(self, request, entity, fields):
--- a/app/soc/views/models/org_app.py	Sun Feb 15 16:11:47 2009 +0000
+++ b/app/soc/views/models/org_app.py	Sun Feb 15 18:50:13 2009 +0000
@@ -183,7 +183,7 @@
 
     program_entity = program_logic.logic.getFromKeyName(kwargs['scope_path'])
 
-    # get all pre-accepted org applications for the given program
+    # get all pre-accepted organization applications for the given program
     filter = {'scope' : program_entity,
               'status' : 'pre-accepted'}
     org_app_entities = org_app_logic.logic.getForFields(filter=filter)
@@ -209,9 +209,13 @@
     template = 'soc/json.html'
 
     response = responses.respond(request, template, context)
-    # TODO IE7 seems to ignore the headers
+    
+    # if the browser supports HTTP/1.1
+    # post-check and pre-check and no-store for IE7
+    response['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'
+    # if the browser supports HTTP/1.0
     response['Pragma'] = 'no-cache'
-    response['Cache-Control'] = 'no-cache, must-revalidate'
+    
     return response