Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Papa Tamsir Kane
erp5
Commits
187d49ae
Commit
187d49ae
authored
Jun 13, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use an interaction workflow to clear preference cache
parent
a24b251b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
317 additions
and
31 deletions
+317
-31
product/ERP5/bootstrap/erp5_core/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
...rtalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
+2
-2
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow.xml
...eItem/portal_workflow/preference_interaction_workflow.xml
+28
-0
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow/interactions.xml
...workflow/preference_interaction_workflow/interactions.xml
+28
-0
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow/interactions/edit.xml
...low/preference_interaction_workflow/interactions/edit.xml
+96
-0
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow/scripts.xml
...rtal_workflow/preference_interaction_workflow/scripts.xml
+28
-0
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow/scripts/InteractionWorkflow_clearCache.xml
...ction_workflow/scripts/InteractionWorkflow_clearCache.xml
+87
-0
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow/variables.xml
...al_workflow/preference_interaction_workflow/variables.xml
+22
-0
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow/worklists.xml
...al_workflow/preference_interaction_workflow/worklists.xml
+22
-0
product/ERP5/bootstrap/erp5_core/bt/revision
product/ERP5/bootstrap/erp5_core/bt/revision
+1
-1
product/ERP5/bootstrap/erp5_core/bt/template_portal_type_workflow_chain_list
...rap/erp5_core/bt/template_portal_type_workflow_chain_list
+2
-0
product/ERP5/bootstrap/erp5_core/bt/template_workflow_id_list
...uct/ERP5/bootstrap/erp5_core/bt/template_workflow_id_list
+1
-0
product/ERP5Form/Document/Preference.py
product/ERP5Form/Document/Preference.py
+0
-28
No files found.
product/ERP5/bootstrap/erp5_core/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
View file @
187d49ae
...
...
@@ -109,7 +109,7 @@
</chain>
<chain>
<type>
Preference
</type>
<workflow>
edit_workflow, preference_workflow
</workflow>
<workflow>
edit_workflow, preference_
interaction_workflow, preference_
workflow
</workflow>
</chain>
<chain>
<type>
Property Existence Constraint
</type>
...
...
@@ -137,7 +137,7 @@
</chain>
<chain>
<type>
System Preference
</type>
<workflow>
edit_workflow, preference_workflow
</workflow>
<workflow>
edit_workflow, preference_
interaction_workflow, preference_
workflow
</workflow>
</chain>
<chain>
<type>
TALES Constraint
</type>
...
...
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow.xml
0 → 100644
View file @
187d49ae
<?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>
groups
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
preference_interaction_workflow
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow/interactions.xml
0 → 100644
View file @
187d49ae
<?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>
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow/interactions/edit.xml
0 → 100644
View file @
187d49ae
<?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>
<tuple/>
</value>
</item>
<item>
<key>
<string>
before_commit_script_name
</string>
</key>
<value>
<list>
<string>
InteractionWorkflow_clearCache
</string>
</list>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Clear cache
</string>
</value>
</item>
<item>
<key>
<string>
guard
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
edit
</string>
</value>
</item>
<item>
<key>
<string>
method_id
</string>
</key>
<value>
<list>
<string>
enable
</string>
<string>
disable
</string>
<string>
_set.*
</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>
<none/>
</value>
</item>
<item>
<key>
<string>
script_name
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
temporary_document_disallowed
</string>
</key>
<value>
<int>
0
</int>
</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>
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow/scripts.xml
0 → 100644
View file @
187d49ae
<?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>
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow/scripts/InteractionWorkflow_clearCache.xml
0 → 100644
View file @
187d49ae
<?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>
"""Clear the cache.\n
\n
This comment is copy pasted from its previous location:\n
TODO: clear different caches according to the preference priority\n
TODO: (XXX) currently, if one use enables / disables a cache, caches\n
for all other users are reset. This is not good for a system\n
in which users do a lot of preference validation. A better solution\n
is needed for this. But it is not easy because the concept of\n
"per user cache" has been proven to be ambiguous or useless.\n
In theory, a solution could consist in using more keys to\n
select caches or to delete "manually" certain cache keys.\n
"""\n
sci.getPortal().portal_caches.clearCache(cache_factory_list=(\'erp5_ui_short\',))\n
</string>
</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>
InteractionWorkflow_clearCache
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow/variables.xml
0 → 100644
View file @
187d49ae
<?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>
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_interaction_workflow/worklists.xml
0 → 100644
View file @
187d49ae
<?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>
product/ERP5/bootstrap/erp5_core/bt/revision
View file @
187d49ae
41091
\ No newline at end of file
41092
\ No newline at end of file
product/ERP5/bootstrap/erp5_core/bt/template_portal_type_workflow_chain_list
View file @
187d49ae
...
...
@@ -33,6 +33,7 @@ Mapped Value | edit_workflow
Memcached Plugin | memcached_plugin_interaction_workflow
Predicate | rule_interaction_workflow
Preference | edit_workflow
Preference | preference_interaction_workflow
Preference | preference_workflow
Property Existence Constraint | dynamic_class_generation_interaction_workflow
Property Sheet Tool | dynamic_class_generation_interaction_workflow
...
...
@@ -41,6 +42,7 @@ Property Type Validity Constraint | dynamic_class_generation_interaction_workflo
Standard Property | dynamic_class_generation_interaction_workflow
String Attribute Match Constraint | dynamic_class_generation_interaction_workflow
System Preference | edit_workflow
System Preference | preference_interaction_workflow
System Preference | preference_workflow
TALES Constraint | dynamic_class_generation_interaction_workflow
Test Component | component_validation_workflow
...
...
product/ERP5/bootstrap/erp5_core/bt/template_workflow_id_list
View file @
187d49ae
...
...
@@ -6,6 +6,7 @@ distributed_ram_cache_interaction_workflow
dynamic_class_generation_interaction_workflow
edit_workflow
memcached_plugin_interaction_workflow
preference_interaction_workflow
preference_workflow
pricing_interaction_workflow
rule_interaction_workflow
...
...
product/ERP5Form/Document/Preference.py
View file @
187d49ae
...
...
@@ -30,7 +30,6 @@ from AccessControl import ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
,
Constraint
from
Products.ERP5Type.Core.Folder
import
Folder
from
Products.CMFCore.utils
import
getToolByName
from
Products.ERP5Form.PreferenceTool
import
PreferenceTool
class
Priority
:
...
...
@@ -66,30 +65,3 @@ class Preference( Folder ):
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
def
_clearCache
(
self
):
"""Clear caches used by methods of this preference
# TODO: clear different caches according to the preference priority
# TODO: (XXX) currently, if one use enables / disables a cache, caches
for all other users are reset. This is not good for a system
in which users do a lot of preference validation. A better solution
is needed for this. But it is not easy because the concept of
"per user cache" has been proven to be ambiguous or useless.
In theory, a solution could consist in using more keys to
select caches or to delete "manually" certain cache keys.
"""
portal_caches
=
getToolByName
(
self
.
getPortalObject
(),
'portal_caches'
)
portal_caches
.
clearCache
(
cache_factory_list
=
(
'erp5_ui_short'
,))
def
_edit
(
self
,
**
kw
):
"""edit and clear all caches"""
self
.
_clearCache
()
Folder
.
_edit
(
self
,
**
kw
)
def
enable
(
self
):
"""Workflow method"""
self
.
_clearCache
()
def
disable
(
self
):
"""Workflow method"""
self
.
_clearCache
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment