From 9166796415ce079d27573a4b03c4dfb44fc80449 Mon Sep 17 00:00:00 2001 From: Roque Porchetto <roque.porchetto@nexedi.com> Date: Fri, 31 Jul 2020 16:03:48 +0000 Subject: [PATCH] erp5_web_renderjs_ui: return modification date in precache json dict script response --- .../WebSection_getPrecacheManifest.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/WebSection_getPrecacheManifest.py b/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/WebSection_getPrecacheManifest.py index 2a9fcafa5c..3dc2c8ca75 100644 --- a/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/WebSection_getPrecacheManifest.py +++ b/bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/WebSection_getPrecacheManifest.py @@ -1,16 +1,5 @@ web_section = context -if REQUEST is not None: - modification_date_string = web_section.getModificationDate().rfc822() - weak_etag_header = 'W/"%s"' % modification_date_string - REQUEST.RESPONSE.setHeader('ETag', weak_etag_header) - if_none_match = REQUEST.getHeader('If-None-Match', '') - #using 'in' instead of '==' because the header value may contain a suffix - #for the server HTTP compression. e.g. "-gzip" suffix for DeflateAlterETag on apache - if weak_etag_header[:-1] in if_none_match: - REQUEST.RESPONSE.setStatus(304) - return "" - # Add all ERP5JS gadget url_list = [ 'favicon.ico', @@ -197,7 +186,11 @@ for precache_manifest_script_id in precache_manifest_url_list: if REQUEST is not None: import json + manifest_dict = { + 'url_dict': dict.fromkeys(url_list), + 'modification_date': context.getModificationDate().rfc822() + } REQUEST.RESPONSE.setHeader('Content-Type', 'application/json') - return json.dumps(dict.fromkeys(url_list), indent=2) + return json.dumps(manifest_dict, indent=2) return list(set(url_list)) -- 2.30.9