Skip to content

Commit

Permalink
Add Cache-Control headers to tile configuration and eit overlay views
Browse files Browse the repository at this point in the history
  • Loading branch information
fredvd committed Sep 9, 2015
1 parent 3adb9fd commit 159c2ee
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -6,6 +6,8 @@ There's a frood who really knows where his towel is.
1.0a12 (unreleased)
^^^^^^^^^^^^^^^^^^^

- Add Cache-Control headers to the @@configure-tile and @@edit-tile views to prevent Internet Explorer from caching the XHR GET requests for these views. What would happen is that you would see the previious (old) field info if you configured or edited a tile, saved and re-opened the same dialog in IE.

- Fix textlinessortable widget for IE11 where IE11 mangles multiform POST data. This fixes removing items from the Caroussel compose widget in IE11.
[fredvd]

Expand Down
8 changes: 8 additions & 0 deletions src/collective/cover/tiles/configuration_view.py
Expand Up @@ -239,3 +239,11 @@ def __init__(self, context, request, tileType):
if self.form_instance is not None:
if getattr(self.form_instance, 'tileType', None) is None:
self.form_instance.tileType = tileType

def __call__(self):
# We add Cache-Control here because IE9-11 cache XHR GET requests. If
# you configure a tile, save and reconfigure you get the previouw
# request. IE will list the request as 304 not modified, in its F12
# tools, but it is never even requested from the server.
self.request.response.setHeader('Cache-Control', 'no-cache, must-revalidate')
return super(DefaultConfigureView, self).__call__()
8 changes: 8 additions & 0 deletions src/collective/cover/tiles/edit.py
Expand Up @@ -107,6 +107,14 @@ class CustomTileEdit(DefaultEditView):
form = CustomEditForm
index = ViewPageTemplateFile('templates/tileformlayout.pt')

def __call__(self):
# We add Cache-Control here because IE9-11 cache XHR GET requests. If
# you edit a tile, save and re-edit you get the previouw request. IE
# will list the request as 304 not modified, in its F12 tools, but it
# is never even requested from the server.
self.request.response.setHeader('Cache-Control', 'no-cache, must-revalidate')
return super(CustomTileEdit, self).__call__()


class CoverTileEditView(EditTile):
"""
Expand Down

0 comments on commit 159c2ee

Please sign in to comment.