Commit 416ea907 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_web: update caching policy behavior. Add possibility to select caching...

erp5_web: update caching policy behavior. Add possibility to select caching policy from WebSite and WebSection

erp5_web: simple yet effective caching policy rules

erp5_web: caching policy fix update names

erp5_web: introduce caching policy category for Web Site and Web Section

erp5_web: fix test related to caching policies

erp5_web: Fix Base_getWebDocumentDrivenModificationDate for empty web sites.

erp5_web: fix Base_getWebDocumentDrivenModificationDate

erp5_web: optimize , fix caching policy

erp5_web: update Base_getWebDocumentDrivenModificationDate portal type list
parent 1c938e16
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base 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>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>caching_policy</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>caching_policy</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Caching Policy</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?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/no-cache</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>no-cache</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>No Cache</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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/one-day-max-modification-date</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>one-day-max-modification-date</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>One Day Max Modification Date</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -10,9 +10,11 @@
</portal_type>
<portal_type id="Web Section">
<item>aggregate</item>
<item>caching_policy</item>
</portal_type>
<portal_type id="Web Site">
<item>aggregate</item>
<item>caching_policy</item>
</portal_type>
<portal_type id="Web Site Module">
<item>business_application</item>
......
<?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>_body</string> </key>
<value> <string>from Products.ERP5Type.Cache import CachingMethod\n
\n
def getLatestModificationDate():\n
document = context.getPortalObject().portal_catalog(\n
portal_type=("Web Section", "Web Site",) + context.getPortalDocumentTypeList(),\n
sort_on=((\'modification_date\', \'descending\'),),\n
select_list=(\'modification_date\',),\n
limit=1,\n
)\n
if document:\n
return document[0].modification_date\n
return getattr(context, \'getModificationDate\', context.modified)()\n
\n
getLatestModificationDate = CachingMethod(\n
getLatestModificationDate,\n
id="Base_getWebDocumentDrivenModificationDate",\n
cache_factory="erp5_content_short",\n
)\n
\n
return getLatestModificationDate()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getWebDocumentDrivenModificationDate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -101,6 +101,7 @@
<string>my_authorization_forced</string>
<string>my_site_map_section_parent</string>
<string>my_site_map_document_parent</string>
<string>my_caching_policy</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_caching_policy</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_category</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Caching Policy</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -114,6 +114,7 @@
<string>my_authorization_forced</string>
<string>my_site_map_section_parent</string>
<string>my_site_map_document_parent</string>
<string>my_caching_policy</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_caching_policy</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_category</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Caching Policy</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -16,7 +16,9 @@
<key> <string>_policy_ids</string> </key>
<value>
<tuple>
<string>unauthenticated web pages</string>
<string>no-cache</string>
<string>one-day-max-modification-date</string>
<string>unauthenticated no language</string>
<string>unauthenticated</string>
<string>authenticated</string>
</tuple>
......@@ -125,6 +127,14 @@
<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></string> </value>
......@@ -135,7 +145,7 @@
</value>
</item>
<item>
<key> <string>unauthenticated</string> </key>
<key> <string>no-cache</string> </key>
<value>
<object>
<klass> <reference id="2.1"/> </klass>
......@@ -144,7 +154,7 @@
<dictionary>
<item>
<key> <string>_enable_304s</string> </key>
<value> <int>1</int> </value>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_etag_func</string> </key>
......@@ -154,11 +164,11 @@
</item>
<item>
<key> <string>_last_modified</string> </key>
<value> <int>1</int> </value>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_max_age_secs</string> </key>
<value> <int>3600</int> </value>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_mtime_func</string> </key>
......@@ -172,7 +182,7 @@
</item>
<item>
<key> <string>_no_cache</string> </key>
<value> <int>0</int> </value>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>_no_store</string> </key>
......@@ -184,7 +194,7 @@
</item>
<item>
<key> <string>_policy_id</string> </key>
<value> <string>unauthenticated</string> </value>
<value> <string>no-cache</string> </value>
</item>
<item>
<key> <string>_post_check</string> </key>
......@@ -214,7 +224,7 @@
</item>
<item>
<key> <string>_public</string> </key>
<value> <int>1</int> </value>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_s_max_age_secs</string> </key>
......@@ -222,9 +232,17 @@
<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>Accept-Language, Cookie</string> </value>
<value> <string></string> </value>
</item>
</dictionary>
</state>
......@@ -232,7 +250,7 @@
</value>
</item>
<item>
<key> <string>unauthenticated web pages</string> </key>
<key> <string>one-day-max-modification-date</string> </key>
<value>
<object>
<klass> <reference id="2.1"/> </klass>
......@@ -255,7 +273,7 @@
</item>
<item>
<key> <string>_max_age_secs</string> </key>
<value> <int>300</int> </value>
<value> <int>600</int> </value>
</item>
<item>
<key> <string>_mtime_func</string> </key>
......@@ -281,7 +299,7 @@
</item>
<item>
<key> <string>_policy_id</string> </key>
<value> <string>unauthenticated web pages</string> </value>
<value> <string>one-day-max-modification-date</string> </value>
</item>
<item>
<key> <string>_post_check</string> </key>
......@@ -319,9 +337,227 @@
<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>360000</int> </value>
</item>
<item>
<key> <string>_vary</string> </key>
<value> <string>Accept-Language, Cookie</string> </value>
<value> <string>Cookie, Authorization, Accept-Encoding</string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>unauthenticated</string> </key>
<value>
<object>
<klass> <reference id="2.1"/> </klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_enable_304s</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>_etag_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAw=</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>600</int> </value>
</item>
<item>
<key> <string>_mtime_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAA0=</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>unauthenticated</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">AAAAAAAAAA4=</string> </persistent>
</value>
</item>
<item>
<key> <string>_private</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_proxy_revalidate</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_public</string> </key>
<value> <int>1</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>360000</int> </value>
</item>
<item>
<key> <string>_vary</string> </key>
<value> <string>Accept-Language, Cookie, Authorization, Accept-Encoding</string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>unauthenticated no language</string> </key>
<value>
<object>
<klass> <reference id="2.1"/> </klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_enable_304s</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>_etag_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAA8=</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>600</int> </value>
</item>
<item>
<key> <string>_mtime_func</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAABA=</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>unauthenticated no language</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">AAAAAAAAABE=</string> </persistent>
</value>
</item>
<item>
<key> <string>_private</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_proxy_revalidate</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_public</string> </key>
<value> <int>1</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>360000</int> </value>
</item>
<item>
<key> <string>_vary</string> </key>
<value> <string>Cookie, Authorization, Accept-Encoding</string> </value>
</item>
</dictionary>
</state>
......@@ -394,7 +630,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: getattr(object, \'getModificationDate\', object.modified)()</string> </value>
<value> <string>object/modified</string> </value>
</item>
</dictionary>
</pickle>
......@@ -407,7 +643,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: member is None</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>
......@@ -433,7 +669,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>
......@@ -446,7 +682,85 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: member is None and object.getPortalType() in ("Web Page", "Web Section", "Web Site")</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>
</record>
<record id="12" aka="AAAAAAAAAAw=">
<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="13" aka="AAAAAAAAAA0=">
<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="14" aka="AAAAAAAAAA4=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: member is None</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="15" aka="AAAAAAAAAA8=">
<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="16" aka="AAAAAAAAABA=">
<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="17" aka="AAAAAAAAABE=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: member is None and object.getWebSiteValue() is not None and ( len(object.getWebSiteValue().getAvailableLanguageSet()) == 1 or object.getWebSiteValue().getStaticLanguageSelection() )</string> </value>
</item>
</dictionary>
</pickle>
......
caching_policy
publication_section
similar
\ No newline at end of file
portal_alarms/fetch_incoming_web_message_list
portal_categories/caching_policy/**
portal_contribution_registry/web_page_by_content
portal_contribution_registry/webpage_extension
portal_contribution_registry/webpage_mimetype
......
......@@ -4,5 +4,7 @@ Web Page | publication_section
Web Page | similar
Web Page | successor
Web Section | aggregate
Web Section | caching_policy
Web Site Module | business_application
Web Site | aggregate
\ No newline at end of file
Web Site | aggregate
Web Site | caching_policy
\ No newline at end of file
......@@ -434,6 +434,8 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
document = document_module.newContent(portal_type=document_portal_type,
reference='NXD-Document-TEXT.Cache')
document.publish()
# Evaluation of last modification date for the site is cached
self.portal.portal_caches.clearCache(cache_factory_list=('erp5_content_short', ))
self.tic()
response = self.publish(website_url + '/NXD-Document-TEXT.Cache')
last_modified_header = response.getHeader('Last-Modified')
......@@ -450,13 +452,14 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
reference = 'P-DMS-Presentation.3.Pages'
document.edit(reference=reference)
document.publish()
self.portal.portal_caches.clearCache(cache_factory_list=('erp5_content_short', ))
self.tic()
# Check we can access to the 3 drawings converted into images.
# Those images can be accessible through extensible content
# url : path-of-document + '/' + 'img' + page-index + '.png'
policy_list = self.portal.caching_policy_manager.listPolicies()
policy = [policy[1] for policy in policy_list\
if policy[0] == 'unauthenticated'][0]
if policy[0] == 'unauthenticated no language'][0]
for i in xrange(3):
path = '/'.join((website_url,
reference,
......@@ -464,10 +467,15 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
response = self.publish(path)
policy_list = self.portal.caching_policy_manager.listPolicies()
policy = [policy for policy in policy_list\
if policy[0] == 'unauthenticated'][0]
if policy[0] == 'unauthenticated no language'][0]
self.assertEquals(response.getHeader('Content-Type'), 'image/png')
self.assertEquals(response.getHeader('Cache-Control'),
'max-age=%s, public' % policy[1].getMaxAgeSecs())
self.assertEquals(
response.getHeader('Cache-Control'),
'max-age=%s, stale-while-revalidate=%s, public' % (
policy[1].getMaxAgeSecs(),
policy[1].getStaleWhileRevalidateSecs(),
)
)
def test_07_TestDocumentViewBehaviour(self):
"""All Documents shared the same downloading behaviour
......@@ -590,6 +598,8 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
document = document_module.newContent(portal_type=document_portal_type,
reference='NXD-Document-1-TEXT.Cache')
document.publish()
# Evaluation of last modification date for the site is cached
self.portal.portal_caches.clearCache(cache_factory_list=('erp5_content_short', ))
self.tic()
response = self.publish(website_url + '/NXD-Document-1-TEXT.Cache')
last_modified_header = response.getHeader('Last-Modified')
......@@ -606,20 +616,21 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
reference = 'P-DMS-Presentation-001-.3.Pages'
document.edit(reference=reference)
document.publish()
self.portal.portal_caches.clearCache(cache_factory_list=('erp5_content_short', ))
self.tic()
# Check we can access to the 3 drawings converted into images.
# Those images can be accessible through extensible content
# url : path-of-document + '/' + 'img' + page-index + '.png'
# Update policy to have stale values
self.portal.caching_policy_manager._updatePolicy(
"unauthenticated", "python: member is None",
"unauthenticated no language", "python: member is None",
"python: getattr(object, 'getModificationDate', object.modified)()",
1200, 30, 600, 0, 0, 0, "Accept-Language, Cookie", "", None,
0, 1, 0, 0, 1, 1, None, None)
self.tic()
policy_list = self.portal.caching_policy_manager.listPolicies()
policy = [policy[1] for policy in policy_list\
if policy[0] == 'unauthenticated'][0]
if policy[0] == 'unauthenticated no language'][0]
# Check policy has been updated
self.assertEquals(policy.getMaxAgeSecs(), 1200)
self.assertEquals(policy.getStaleWhileRevalidateSecs(), 30)
......
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