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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
erp5
Commits
3d5096a5
Commit
3d5096a5
authored
Feb 07, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement reset performed only once at transaction boundary (similarly to Portal Type classes).
parent
8a3acd8e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
5 deletions
+25
-5
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_interaction_workflow/scripts/reset.xml
...workflow/component_interaction_workflow/scripts/reset.xml
+1
-1
product/ERP5/bootstrap/erp5_core/bt/change_log
product/ERP5/bootstrap/erp5_core/bt/change_log
+3
-0
product/ERP5/bootstrap/erp5_core/bt/revision
product/ERP5/bootstrap/erp5_core/bt/revision
+1
-1
product/ERP5Type/Tool/ComponentTool.py
product/ERP5Type/Tool/ComponentTool.py
+20
-3
No files found.
product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_interaction_workflow/scripts/reset.xml
View file @
3d5096a5
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
state_change[\'object\'].
reset
()\n
<value>
<string>
state_change[\'object\'].
getPortalObject().portal_components.resetOnceAtTransactionBoundary
()\n
</string>
</value>
</item>
<item>
...
...
product/ERP5/bootstrap/erp5_core/bt/change_log
View file @
3d5096a5
2012-02-07 arnaud.fontaine
* Use resetOnceAtTransactionBoundary when a Component has been modified.
2012-02-02 arnaud.fontaine
* Perform revalidate automatically rather than requiring a manual action.
...
...
product/ERP5/bootstrap/erp5_core/bt/revision
View file @
3d5096a5
40999
\ No newline at end of file
41000
\ No newline at end of file
product/ERP5Type/Tool/ComponentTool.py
View file @
3d5096a5
...
...
@@ -27,9 +27,12 @@
#
##############################################################################
import
transaction
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type.Tool.BaseTool
import
BaseTool
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.TransactionalVariable
import
getTransactionalVariable
from
zLOG
import
LOG
,
INFO
,
WARNING
...
...
@@ -46,7 +49,7 @@ class ComponentTool(BaseTool):
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareProtected
(
Permissions
.
M
anagePortal
,
'reset'
)
security
.
declareProtected
(
Permissions
.
M
odifyPortalContent
,
'reset'
)
def
reset
(
self
,
is_sync
=
False
):
"""
XXX-arnau: global reset
...
...
@@ -82,13 +85,27 @@ class ComponentTool(BaseTool):
type_tool
.
resetDynamicDocumentsOnceAtTransactionBoundary
()
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'resetOnceAtTransactionBoundary'
)
def
resetOnceAtTransactionBoundary
(
self
):
"""
Schedule a single reset at the end of the transaction, only once. The
idea behind this is that a reset is (very) costly and that we want to do
it as little often as possible. Moreover, doing it twice in a transaction
is useless (but still twice as costly).
"""
tv
=
getTransactionalVariable
()
key
=
'ComponentTool.resetOnceAtTransactionBoundary'
if
key
not
in
tv
:
tv
[
key
]
=
None
transaction
.
get
().
addBeforeCommitHook
(
self
.
reset
)
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'createAllComponentFromFilesystem'
)
def
createAllComponentFromFilesystem
(
self
,
erase_existing
=
False
,
REQUEST
=
None
):
"""
XXX-arnau: only Extensions for now
XXX-arnau: only bt5 Extensions and Documents for now
"""
portal
=
self
.
getPortalObject
()
...
...
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