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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bryan Kaperick
erp5
Commits
854bc009
Commit
854bc009
authored
Feb 29, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that Components are properly reset on all ZEO clients.
parent
bb7855ca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
11 deletions
+28
-11
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+10
-1
product/ERP5Type/Tool/ComponentTool.py
product/ERP5Type/Tool/ComponentTool.py
+7
-5
product/ERP5Type/tests/testDynamicClassGeneration.py
product/ERP5Type/tests/testDynamicClassGeneration.py
+11
-5
No files found.
product/ERP5/ERP5Site.py
View file @
854bc009
...
@@ -339,7 +339,16 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
...
@@ -339,7 +339,16 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
if
'ERP5Site.__of__'
not
in
tv
and
type
(
parent
)
is
Application
:
if
'ERP5Site.__of__'
not
in
tv
and
type
(
parent
)
is
Application
:
tv
[
'ERP5Site.__of__'
]
=
None
tv
[
'ERP5Site.__of__'
]
=
None
setSite
(
self
)
setSite
(
self
)
synchronizeDynamicModules
(
self
)
# If Components are reset, then portal type classes should be reset
try
:
reset_portal_type
=
self
.
portal_components
.
reset
(
force
=
False
,
reset_portal_type
=
False
)
# This should only happen before erp5_core is installed
except
AttributeError
:
reset_portal_type
=
False
synchronizeDynamicModules
(
self
,
force
=
reset_portal_type
)
return
self
return
self
def
manage_beforeDelete
(
self
,
item
,
container
):
def
manage_beforeDelete
(
self
,
item
,
container
):
...
...
product/ERP5Type/Tool/ComponentTool.py
View file @
854bc009
...
@@ -41,7 +41,7 @@ from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
...
@@ -41,7 +41,7 @@ from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from
zLOG
import
LOG
,
INFO
,
WARNING
from
zLOG
import
LOG
,
INFO
,
WARNING
_
last_sync
=
-
1
last_sync
=
-
1
class
ComponentTool
(
BaseTool
):
class
ComponentTool
(
BaseTool
):
"""
"""
This tool provides methods to load the the different types of
This tool provides methods to load the the different types of
...
@@ -72,7 +72,7 @@ class ComponentTool(BaseTool):
...
@@ -72,7 +72,7 @@ class ComponentTool(BaseTool):
delattr
(
module
,
name
)
delattr
(
module
,
name
)
security
.
declareProtected
(
Permissions
.
ResetDynamicClasses
,
'reset'
)
security
.
declareProtected
(
Permissions
.
ResetDynamicClasses
,
'reset'
)
def
reset
(
self
,
force
=
True
):
def
reset
(
self
,
force
=
True
,
reset_portal_type
=
True
):
"""
"""
XXX-arnau: global reset
XXX-arnau: global reset
"""
"""
...
@@ -89,8 +89,7 @@ class ComponentTool(BaseTool):
...
@@ -89,8 +89,7 @@ class ComponentTool(BaseTool):
else
:
else
:
cookie
=
portal
.
getCacheCookie
(
'component_packages'
)
cookie
=
portal
.
getCacheCookie
(
'component_packages'
)
if
cookie
==
last_sync
:
if
cookie
==
last_sync
:
type_tool
.
resetDynamicDocumentsOnceAtTransactionBoundary
()
return
False
return
last_sync
=
cookie
last_sync
=
cookie
LOG
(
"ERP5Type.Tool.ComponentTool"
,
INFO
,
"Resetting Components"
)
LOG
(
"ERP5Type.Tool.ComponentTool"
,
INFO
,
"Resetting Components"
)
...
@@ -115,7 +114,10 @@ class ComponentTool(BaseTool):
...
@@ -115,7 +114,10 @@ class ComponentTool(BaseTool):
module
.
_resetRegistry
()
module
.
_resetRegistry
()
self
.
_resetModule
(
module
)
self
.
_resetModule
(
module
)
type_tool
.
resetDynamicDocumentsOnceAtTransactionBoundary
()
if
reset_portal_type
:
type_tool
.
resetDynamicDocumentsOnceAtTransactionBoundary
()
return
True
security
.
declareProtected
(
Permissions
.
ResetDynamicClasses
,
security
.
declareProtected
(
Permissions
.
ResetDynamicClasses
,
'resetOnceAtTransactionBoundary'
)
'resetOnceAtTransactionBoundary'
)
...
...
product/ERP5Type/tests/testDynamicClassGeneration.py
View file @
854bc009
...
@@ -1209,12 +1209,18 @@ ComponentTool._original_reset = ComponentTool.reset
...
@@ -1209,12 +1209,18 @@ ComponentTool._original_reset = ComponentTool.reset
ComponentTool
.
_reset_performed
=
False
ComponentTool
.
_reset_performed
=
False
def
assertResetNotCalled
(
*
args
,
**
kwargs
):
def
assertResetNotCalled
(
*
args
,
**
kwargs
):
raise
AssertionError
(
"reset should not have been performed"
)
reset_performed
=
ComponentTool
.
_original_reset
(
*
args
,
**
kwargs
)
if
reset_performed
:
raise
AssertionError
(
"reset should not have been performed"
)
def
assertResetCalled
(
self
,
*
args
,
**
kwargs
):
return
reset_performed
from
Products.ERP5Type.Tool.ComponentTool
import
ComponentTool
ComponentTool
.
_reset_performed
=
True
def
assertResetCalled
(
*
args
,
**
kwargs
):
return
ComponentTool
.
_original_reset
(
self
,
*
args
,
**
kwargs
)
reset_performed
=
ComponentTool
.
_original_reset
(
*
args
,
**
kwargs
)
if
reset_performed
:
ComponentTool
.
_reset_performed
=
True
return
reset_performed
import
abc
import
abc
...
...
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