Commit 5c26fd57 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: fixup modification date retrieval

See nexedi/erp5@2e3f7a8a
parent e7e197da
from DateTime import DateTime
import json
if REQUEST is None: if REQUEST is None:
REQUEST = context.REQUEST REQUEST = context.REQUEST
if response is None: if response is None:
...@@ -10,13 +13,13 @@ response.setBase(None) ...@@ -10,13 +13,13 @@ response.setBase(None)
response.setHeader("Access-Control-Allow-Origin", "*") response.setHeader("Access-Control-Allow-Origin", "*")
web_page = context web_page = context
web_section = REQUEST.get("current_web_section") web_section = context.getWebSectionValue()
if web_section is None: # Must-Revalidate caching policy uses Base_getWebSiteDrivenModificationDate
parent_value = context.getParentValue() modification_date_string = web_page.Base_getWebSiteDrivenModificationDate().rfc822()
if parent_value.getPortalType() == "Web Section":
web_section = parent_value
if REQUEST.getHeader('If-Modified-Since', '') == web_page.getModificationDate().rfc822(): modified_since = REQUEST.getHeader('If-Modified-Since', '')
if modified_since:
if DateTime(modified_since).rfc822() == modification_date_string:
response.setStatus(304) response.setStatus(304)
return "" return ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment