Commit 2e3f7a8a authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web] Use web site modification date in must revalidate policy

Ensure that if the web site policy is just set to Must-Revalidate, all documents are updated.
It forces HTTP Cache middleware to refresh their contents.
parent 822bd0bd
modification_date = context.getModificationDate()
# Ensure that if the web site policy is just set to Must-Revalidate, all documents are updated.
# It forces HTTP Cache middleware to refresh there contents.
is_web_mode = (context.REQUEST.get('current_web_section', None) is not None) or (hasattr(context, 'isWebMode') and context.isWebMode())
if is_web_mode:
modification_date = max(modification_date, context.getWebSectionValue().getModificationDate())
return modification_date
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getWebSiteDrivenModificationDate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -1464,7 +1464,7 @@ ...@@ -1464,7 +1464,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python: getattr(object, \'getModificationDate\', object.modified)()</string> </value> <value> <string>python: getattr(object, \'Base_getWebSiteDrivenModificationDate\', object.modified)()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
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