Commit eea71780 authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by wenjie.zheng

erp5_web: add hateoas caching policy

parent 8cefa6a3
......@@ -788,10 +788,6 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
if is_site_root:\n
\n
result_dict[\'default_view\'] = \'view\'\n
# XXX Hardcoded cache for 30 minutes. Should only bother developers but speed up Jio access\n
response.setHeader("Cache-Control", "public, max-age=1800")\n
response.setHeader("Vary", "Cookie")\n
response.setHeader("Last-Modified", DateTime().rfc822())\n
REQUEST.set("X-HATEOAS-CACHE", 1)\n
\n
# Global action users for the jIO plugin\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>caching_policy/hateoas</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>hateoas</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Hateoas</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -22,6 +22,7 @@
<string>public-conversion-result</string>
<string>unauthenticated no language</string>
<string>unauthenticated</string>
<string>hateoas</string>
<string>authenticated</string>
</tuple>
</value>
......@@ -147,7 +148,7 @@
</value>
</item>
<item>
<key> <string>no-cache</string> </key>
<key> <string>hateoas</string> </key>
<value>
<object>
<klass> <reference id="2.1"/> </klass>
......@@ -164,6 +165,111 @@
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key> <string>_last_modified</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>_max_age_secs</string> </key>
<value> <int>1800</int> </value>
</item>
<item>
<key> <string>_mtime_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
</value>
</item>
<item>
<key> <string>_must_revalidate</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_no_cache</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_no_store</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_no_transform</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_policy_id</string> </key>
<value> <string>hateoas</string> </value>
</item>
<item>
<key> <string>_post_check</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_pre_check</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_predicate</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
</value>
</item>
<item>
<key> <string>_private</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>_proxy_revalidate</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_public</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_s_max_age_secs</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_stale_if_error_secs</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_stale_while_revalidate_secs</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_vary</string> </key>
<value> <string>Cookie, Authorization</string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>no-cache</string> </key>
<value>
<object>
<klass> <reference id="2.1"/> </klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_enable_304s</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_etag_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</value>
</item>
<item>
<key> <string>_last_modified</string> </key>
<value> <int>0</int> </value>
......@@ -175,7 +281,7 @@
<item>
<key> <string>_mtime_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent>
</value>
</item>
<item>
......@@ -213,7 +319,7 @@
<item>
<key> <string>_predicate</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAs=</string> </persistent>
</value>
</item>
<item>
......@@ -266,7 +372,7 @@
<item>
<key> <string>_etag_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAw=</string> </persistent>
</value>
</item>
<item>
......@@ -280,7 +386,7 @@
<item>
<key> <string>_mtime_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAA0=</string> </persistent>
</value>
</item>
<item>
......@@ -318,7 +424,7 @@
<item>
<key> <string>_predicate</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAs=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAA4=</string> </persistent>
</value>
</item>
<item>
......@@ -371,7 +477,7 @@
<item>
<key> <string>_etag_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAw=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAA8=</string> </persistent>
</value>
</item>
<item>
......@@ -385,7 +491,7 @@
<item>
<key> <string>_mtime_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAA0=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAABA=</string> </persistent>
</value>
</item>
<item>
......@@ -423,7 +529,7 @@
<item>
<key> <string>_predicate</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAA4=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAABE=</string> </persistent>
</value>
</item>
<item>
......@@ -476,7 +582,7 @@
<item>
<key> <string>_etag_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAA8=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAABI=</string> </persistent>
</value>
</item>
<item>
......@@ -490,7 +596,7 @@
<item>
<key> <string>_mtime_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAABA=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAABM=</string> </persistent>
</value>
</item>
<item>
......@@ -528,7 +634,7 @@
<item>
<key> <string>_predicate</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAABE=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAABQ=</string> </persistent>
</value>
</item>
<item>
......@@ -581,7 +687,7 @@
<item>
<key> <string>_etag_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAABI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAABU=</string> </persistent>
</value>
</item>
<item>
......@@ -595,7 +701,7 @@
<item>
<key> <string>_mtime_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAABM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAABY=</string> </persistent>
</value>
</item>
<item>
......@@ -633,7 +739,7 @@
<item>
<key> <string>_predicate</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAABQ=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAABc=</string> </persistent>
</value>
</item>
<item>
......@@ -686,7 +792,7 @@
<item>
<key> <string>_etag_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAABU=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAABg=</string> </persistent>
</value>
</item>
<item>
......@@ -700,7 +806,7 @@
<item>
<key> <string>_mtime_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAABY=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAABk=</string> </persistent>
</value>
</item>
<item>
......@@ -738,7 +844,7 @@
<item>
<key> <string>_predicate</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAABc=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAABo=</string> </persistent>
</value>
</item>
<item>
......@@ -842,7 +948,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>object/modified</string> </value>
<value> <string>python: getattr(object, \'getModificationDate\', object.modified)()</string> </value>
</item>
</dictionary>
</pickle>
......@@ -855,7 +961,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: member is None and (lambda x: x is not None and x.getCachingPolicy() == \'no-cache\')(object.getWebSectionValue())</string> </value>
<value> <string>python: member is not None and (lambda x: x is not None and x.getCachingPolicy() =="hateoas")(object.getWebSectionValue()) and request.get("X-HATEOAS-CACHE")</string> </value>
</item>
</dictionary>
</pickle>
......@@ -881,7 +987,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: max(getattr(object, \'Base_getWebDocumentDrivenModificationDate\', object.modified)(), DateTime().earliestTime())</string> </value>
<value> <string>object/modified</string> </value>
</item>
</dictionary>
</pickle>
......@@ -894,7 +1000,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: member is None and (lambda x: x is not None and x.getCachingPolicy() == \'one-day-max-modification-date\')(object.getWebSectionValue())</string> </value>
<value> <string>python: member is None and (lambda x: x is not None and x.getCachingPolicy() == \'no-cache\')(object.getWebSectionValue())</string> </value>
</item>
</dictionary>
</pickle>
......@@ -920,7 +1026,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: getattr(object, \'getModificationDate\', object.modified)()</string> </value>
<value> <string>python: max(getattr(object, \'Base_getWebDocumentDrivenModificationDate\', object.modified)(), DateTime().earliestTime())</string> </value>
</item>
</dictionary>
</pickle>
......@@ -933,7 +1039,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: object.Base_isPublicConvertionResult() and (lambda x: x is not None and not (len(x.getAvailableLanguageSet()) == 1 or x.getStaticLanguageSelection()))(object.getWebSectionValue())</string> </value>
<value> <string>python: member is None and (lambda x: x is not None and x.getCachingPolicy() == \'one-day-max-modification-date\')(object.getWebSectionValue())</string> </value>
</item>
</dictionary>
</pickle>
......@@ -972,7 +1078,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: object.Base_isPublicConvertionResult() and (lambda x: x is not None and (len(x.getAvailableLanguageSet()) == 1 or x.getStaticLanguageSelection()))(object.getWebSectionValue())</string> </value>
<value> <string>python: object.Base_isPublicConvertionResult() and (lambda x: x is not None and not (len(x.getAvailableLanguageSet()) == 1 or x.getStaticLanguageSelection()))(object.getWebSectionValue())</string> </value>
</item>
</dictionary>
</pickle>
......@@ -998,7 +1104,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: getattr(object, \'Base_getWebDocumentDrivenModificationDate\', object.modified)()</string> </value>
<value> <string>python: getattr(object, \'getModificationDate\', object.modified)()</string> </value>
</item>
</dictionary>
</pickle>
......@@ -1011,7 +1117,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: member is None and (lambda x: x is not None and not (len(x.getAvailableLanguageSet()) == 1 or x.getStaticLanguageSelection()))(object.getWebSectionValue())</string> </value>
<value> <string>python: object.Base_isPublicConvertionResult() and (lambda x: x is not None and (len(x.getAvailableLanguageSet()) == 1 or x.getStaticLanguageSelection()))(object.getWebSectionValue())</string> </value>
</item>
</dictionary>
</pickle>
......@@ -1043,6 +1149,45 @@
</pickle>
</record>
<record id="23" aka="AAAAAAAAABc=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: member is None and (lambda x: x is not None and not (len(x.getAvailableLanguageSet()) == 1 or x.getStaticLanguageSelection()))(object.getWebSectionValue())</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="24" aka="AAAAAAAAABg=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="25" aka="AAAAAAAAABk=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: getattr(object, \'Base_getWebDocumentDrivenModificationDate\', object.modified)()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="26" aka="AAAAAAAAABo=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
......
......@@ -233,6 +233,7 @@
<value>
<tuple>
<string>aggregate/web_page_module/rjs_gadget_erp5_html</string>
<string>caching_policy/hateoas</string>
</tuple>
</value>
</item>
......@@ -483,7 +484,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>941.35235.58430.32802</string> </value>
<value> <string>944.53459.40487.3686</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -501,8 +502,8 @@
</tuple>
<state>
<tuple>
<float>1425895920.4</float>
<string>GMT</string>
<float>1439219895.9</float>
<string>UTC</string>
</tuple>
</state>
</object>
......
......@@ -147,6 +147,14 @@
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>caching_policy/hateoas</string>
</tuple>
</value>
</item>
<item>
<key> <string>container_layout</string> </key>
<value> <string>ERP5Document_getHateoas</string> </value>
......
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