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
Boris Kocherov
erp5
Commits
95f3f8f5
Commit
95f3f8f5
authored
Mar 01, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up reset in __of__.
parent
d702bf05
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
13 deletions
+14
-13
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+6
-6
product/ERP5Type/Tool/ComponentTool.py
product/ERP5Type/Tool/ComponentTool.py
+3
-2
product/ERP5Type/tests/testDynamicClassGeneration.py
product/ERP5Type/tests/testDynamicClassGeneration.py
+5
-5
No files found.
product/ERP5/ERP5Site.py
View file @
95f3f8f5
...
...
@@ -340,15 +340,15 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
tv
[
'ERP5Site.__of__'
]
=
None
setSite
(
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
component_tool
=
self
.
portal_components
except
AttributeError
:
reset_portal_type
=
False
# This should only happen before erp5_core is installed
synchronizeDynamicModules
(
self
)
else
:
# If Components are reset, then portal type classes should be reset
synchronizeDynamicModules
(
self
,
component_tool
.
reset
())
synchronizeDynamicModules
(
self
,
force
=
True
)
return
self
def
manage_beforeDelete
(
self
,
item
,
container
):
...
...
product/ERP5Type/Tool/ComponentTool.py
View file @
95f3f8f5
...
...
@@ -56,7 +56,7 @@ class ComponentTool(BaseTool):
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareProtected
(
Permissions
.
ResetDynamicClasses
,
'reset'
)
def
reset
(
self
,
force
=
True
,
reset_portal_type
=
Tru
e
):
def
reset
(
self
,
force
=
False
,
reset_portal_type
=
Fals
e
):
"""
XXX-arnau: global reset
"""
...
...
@@ -115,4 +115,5 @@ class ComponentTool(BaseTool):
key
=
'ComponentTool.resetOnceAtTransactionBoundary'
if
key
not
in
tv
:
tv
[
key
]
=
None
transaction
.
get
().
addBeforeCommitHook
(
self
.
reset
)
transaction
.
get
().
addBeforeCommitHook
(
self
.
reset
,
args
=
(
True
,
True
))
product/ERP5Type/tests/testDynamicClassGeneration.py
View file @
95f3f8f5
...
...
@@ -1254,7 +1254,7 @@ class _TestZodbComponent(SecurityTestCase):
self
.
_component_tool
=
self
.
getPortal
().
portal_components
self
.
_module
=
__import__
(
self
.
_getComponentModuleName
(),
fromlist
=
[
'erp5.component'
])
self
.
_component_tool
.
reset
()
self
.
_component_tool
.
reset
(
force
=
True
,
reset_portal_type
=
True
)
@
abc
.
abstractmethod
def
_newComponent
(
self
,
reference
,
text_content
,
version
=
'erp5'
):
...
...
@@ -1362,7 +1362,7 @@ class _TestZodbComponent(SecurityTestCase):
self
.
assertEquals
(
error_message
,
error_list
[
0
])
self
.
assertEquals
(
component
.
getReference
(),
invalid_reference
)
self
.
assertEquals
(
component
.
getReference
(
validated_only
=
True
),
valid_reference
)
self
.
_component_tool
.
reset
()
self
.
_component_tool
.
reset
(
force
=
True
,
reset_portal_type
=
True
)
self
.
assertModuleImportable
(
valid_reference
)
ComponentTool
.
reset
=
assertResetCalled
...
...
@@ -1430,7 +1430,7 @@ class _TestZodbComponent(SecurityTestCase):
self
.
assertEquals
(
error_message
,
error_list
[
0
])
self
.
assertEquals
(
component
.
getVersion
(),
invalid_version
)
self
.
assertEquals
(
component
.
getVersion
(
validated_only
=
True
),
valid_version
)
self
.
_component_tool
.
reset
()
self
.
_component_tool
.
reset
(
force
=
True
,
reset_portal_type
=
True
)
self
.
assertModuleImportable
(
reference
)
ComponentTool
.
reset
=
assertResetCalled
...
...
@@ -1495,7 +1495,7 @@ class _TestZodbComponent(SecurityTestCase):
self
.
assertTrue
(
error_list
[
0
].
startswith
(
error_message
))
self
.
assertEquals
(
component
.
getTextContent
(),
invalid_code
)
self
.
assertEquals
(
component
.
getTextContent
(
validated_only
=
True
),
valid_code
)
self
.
_component_tool
.
reset
()
self
.
_component_tool
.
reset
(
force
=
True
,
reset_portal_type
=
True
)
self
.
assertModuleImportable
(
'TestComponentWithSyntaxError'
)
ComponentTool
.
reset
=
assertResetCalled
...
...
@@ -1780,7 +1780,7 @@ class TestPortalType(Person):
self
.
assertFalse
(
self
.
_module
.
TestPortalType
in
person
.
__class__
.
mro
())
# Reset Portal Type classes to ghost to make sure that everything is reset
self
.
_component_tool
.
reset
()
self
.
_component_tool
.
reset
(
force
=
True
,
reset_portal_type
=
True
)
# TestPortalType must be in available type class list
self
.
assertTrue
(
'TestPortalType'
in
person_type
.
getDocumentTypeList
())
...
...
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