From 8e6c3ffe3f74b6b5d2ac1b9fbe828da021263a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Fri, 12 May 2017 03:11:35 +0000 Subject: [PATCH] base: drop person_interaction_workflow We do not need to pre-create user preferences, especially that creating them too early creates one preferences for each person created in person module and does not allow Person_createUserPreference to create preference based on person's assignments are they are not created yet. We do not need to clear cache when deleting user logins anymore. This problem was fixed differently. Adjust tests that was relying on cache being cleared when persons ar deleted: testERP5Web.TestERP5Web.test_15_Check_LastModified_Header was never isolated from test_14. test_14 was filling Base_getWebDocumentDrivenModificationDate cache and this cache got clear when the persons where being deleted during tearDown. When removing this interaction clearing cache, we revealed this weakness. Choosen solution was to clear cache before checking response headers, to make sure we don't get something filled by a previous test. --- .../workflow_chain_type.xml | 2 +- .../person_interaction_workflow.xml | 46 --------- .../interactions.xml | 28 ------ ...tentShortCache_onDeleteUserLoginPerson.xml | 93 ------------------- .../interactions/setReference.xml | 90 ------------------ .../person_interaction_workflow/scripts.xml | 28 ------ .../scripts/Person_clearContentShortCache.py | 6 -- .../scripts/Person_clearContentShortCache.xml | 70 -------------- .../scripts/Person_createUserPreference.py | 5 - .../scripts/Person_createUserPreference.xml | 70 -------------- .../person_interaction_workflow/variables.xml | 22 ----- .../person_interaction_workflow/worklists.xml | 22 ----- .../template_portal_type_workflow_chain_list | 1 - bt5/erp5_base/bt/template_workflow_id_list | 1 - product/ERP5/tests/testERP5Web.py | 2 + 15 files changed, 3 insertions(+), 483 deletions(-) delete mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow.xml delete mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions.xml delete mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/ClearContentShortCache_onDeleteUserLoginPerson.xml delete mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/setReference.xml delete mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts.xml delete mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_clearContentShortCache.py delete mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_clearContentShortCache.xml delete mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_createUserPreference.py delete mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_createUserPreference.xml delete mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/variables.xml delete mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/worklists.xml diff --git a/bt5/erp5_base/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml b/bt5/erp5_base/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml index c57c18ea44..f85bb3b929 100644 --- a/bt5/erp5_base/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml +++ b/bt5/erp5_base/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml @@ -89,7 +89,7 @@ </chain> <chain> <type>Person</type> - <workflow>edit_workflow, person_interaction_workflow, user_account_workflow, validation_workflow</workflow> + <workflow>edit_workflow, user_account_workflow, validation_workflow</workflow> </chain> <chain> <type>Query</type> diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow.xml deleted file mode 100644 index 9e1b8dd2dc..0000000000 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="InteractionWorkflowDefinition" module="Products.ERP5.InteractionWorkflow"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_objects</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>creation_guard</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>description</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>groups</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>person_interaction_workflow</string> </value> - </item> - <item> - <key> <string>manager_bypass</string> </key> - <value> <int>0</int> </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string>Interacts for Person type events</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions.xml deleted file mode 100644 index e18bf8cbf7..0000000000 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="Interaction" module="Products.ERP5.Interaction"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_mapping</string> </key> - <value> - <dictionary/> - </value> - </item> - <item> - <key> <string>_objects</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>interactions</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/ClearContentShortCache_onDeleteUserLoginPerson.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/ClearContentShortCache_onDeleteUserLoginPerson.xml deleted file mode 100644 index 9cb8aa3b65..0000000000 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/ClearContentShortCache_onDeleteUserLoginPerson.xml +++ /dev/null @@ -1,93 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="InteractionDefinition" module="Products.ERP5.Interaction"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>actbox_category</string> </key> - <value> <string>workflow</string> </value> - </item> - <item> - <key> <string>actbox_name</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>actbox_url</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>activate_script_name</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>after_script_name</string> </key> - <value> - <list> - <string>Person_clearContentShortCache</string> - </list> - </value> - </item> - <item> - <key> <string>before_commit_script_name</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>description</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>guard</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>ClearContentShortCache_onDeleteUserLoginPerson</string> </value> - </item> - <item> - <key> <string>method_id</string> </key> - <value> - <list> - <string>delete</string> - <string>manage_beforeDelete</string> - </list> - </value> - </item> - <item> - <key> <string>once_per_transaction</string> </key> - <value> <int>1</int> </value> - </item> - <item> - <key> <string>portal_type_filter</string> </key> - <value> - <list> - <string>Person</string> - </list> - </value> - </item> - <item> - <key> <string>script_name</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>trigger_type</string> </key> - <value> <int>2</int> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/setReference.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/setReference.xml deleted file mode 100644 index d6576fac6f..0000000000 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/setReference.xml +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="InteractionDefinition" module="Products.ERP5.Interaction"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>actbox_category</string> </key> - <value> <string>workflow</string> </value> - </item> - <item> - <key> <string>actbox_name</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>actbox_url</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>activate_script_name</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>after_script_name</string> </key> - <value> - <list> - <string>Person_createUserPreference</string> - </list> - </value> - </item> - <item> - <key> <string>before_commit_script_name</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>description</string> </key> - <value> <string>set a user id</string> </value> - </item> - <item> - <key> <string>guard</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>setReference</string> </value> - </item> - <item> - <key> <string>method_id</string> </key> - <value> - <list> - <string>_setUserId</string> - </list> - </value> - </item> - <item> - <key> <string>once_per_transaction</string> </key> - <value> <int>0</int> </value> - </item> - <item> - <key> <string>portal_type_filter</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>script_name</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>trigger_type</string> </key> - <value> <int>2</int> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts.xml deleted file mode 100644 index 072c8f6540..0000000000 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="Scripts" module="Products.DCWorkflow.Scripts"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_mapping</string> </key> - <value> - <dictionary/> - </value> - </item> - <item> - <key> <string>_objects</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>scripts</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_clearContentShortCache.py b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_clearContentShortCache.py deleted file mode 100644 index 347c2d12ab..0000000000 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_clearContentShortCache.py +++ /dev/null @@ -1,6 +0,0 @@ -# XXX-Luke: Seb pointed out that this is very bad idea to clear cache. -document = state_change['object'] -if document.Person_getUserId() is not None: - cache_tool = document.getPortalObject().portal_caches - cache_tool.clearCache(cache_factory_list=('erp5_content_short', ), - before_commit=True) diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_clearContentShortCache.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_clearContentShortCache.xml deleted file mode 100644 index 3520a4df14..0000000000 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_clearContentShortCache.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?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>state_change</string> </value> - </item> - <item> - <key> <string>_proxy_roles</string> </key> - <value> - <tuple> - <string>Manager</string> - </tuple> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>Person_clearContentShortCache</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_createUserPreference.py b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_createUserPreference.py deleted file mode 100644 index ebf7f91824..0000000000 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_createUserPreference.py +++ /dev/null @@ -1,5 +0,0 @@ -person = sci['object'] -if person.Person_getUserId(): - person.activate(after_path_and_method_id=(person.getPath(), - ('immediateReindexObject', - 'recursiveImmediateReindexObject'))).Person_createUserPreference() diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_createUserPreference.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_createUserPreference.xml deleted file mode 100644 index 9ce6255fb5..0000000000 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_createUserPreference.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?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>sci</string> </value> - </item> - <item> - <key> <string>_proxy_roles</string> </key> - <value> - <tuple> - <string>Manager</string> - </tuple> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>Person_createUserPreference</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/variables.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/variables.xml deleted file mode 100644 index 6ae03699d1..0000000000 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/variables.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="Variables" module="Products.DCWorkflow.Variables"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_mapping</string> </key> - <value> - <dictionary/> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>variables</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/worklists.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/worklists.xml deleted file mode 100644 index c3432aa051..0000000000 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/worklists.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="Worklists" module="Products.DCWorkflow.Worklists"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_mapping</string> </key> - <value> - <dictionary/> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>worklists</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_base/bt/template_portal_type_workflow_chain_list b/bt5/erp5_base/bt/template_portal_type_workflow_chain_list index d49d46c76c..af2b791e41 100644 --- a/bt5/erp5_base/bt/template_portal_type_workflow_chain_list +++ b/bt5/erp5_base/bt/template_portal_type_workflow_chain_list @@ -43,7 +43,6 @@ Notification Message | processing_status_workflow Organisation | edit_workflow Organisation | validation_workflow Person | edit_workflow -Person | person_interaction_workflow Person | user_account_workflow Person | validation_workflow Query | edit_workflow diff --git a/bt5/erp5_base/bt/template_workflow_id_list b/bt5/erp5_base/bt/template_workflow_id_list index 52f3391735..c349119306 100644 --- a/bt5/erp5_base/bt/template_workflow_id_list +++ b/bt5/erp5_base/bt/template_workflow_id_list @@ -13,7 +13,6 @@ local_permission_interaction_workflow login_validation_workflow movement_resource_interaction_workflow notification_message_workflow -person_interaction_workflow processing_status_workflow query_workflow reindex_object_interaction_workflow diff --git a/product/ERP5/tests/testERP5Web.py b/product/ERP5/tests/testERP5Web.py index 60cc7686d6..fc4b1c2b98 100644 --- a/product/ERP5/tests/testERP5Web.py +++ b/product/ERP5/tests/testERP5Web.py @@ -1264,6 +1264,8 @@ Hé Hé Hé!""", page.asText().strip()) reference='NXD-Document.Cache', text_content=content) document.publish() + # clear cache used in Base_getWebDocumentDrivenModificationDate + self.portal.portal_caches.clearAllCache() self.tic() path = website.absolute_url_path() + '/NXD-Document.Cache' # test Different Policy installed by erp5_web -- 2.30.9