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
Tomáš Peterka
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
Show 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):
...
@@ -340,15 +340,15 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
tv
[
'ERP5Site.__of__'
]
=
None
tv
[
'ERP5Site.__of__'
]
=
None
setSite
(
self
)
setSite
(
self
)
# If Components are reset, then portal type classes should be reset
try
:
try
:
reset_portal_type
=
self
.
portal_components
.
reset
(
force
=
False
,
component_tool
=
self
.
portal_components
reset_portal_type
=
False
)
# This should only happen before erp5_core is installed
except
AttributeError
:
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
return
self
def
manage_beforeDelete
(
self
,
item
,
container
):
def
manage_beforeDelete
(
self
,
item
,
container
):
...
...
product/ERP5Type/Tool/ComponentTool.py
View file @
95f3f8f5
...
@@ -56,7 +56,7 @@ class ComponentTool(BaseTool):
...
@@ -56,7 +56,7 @@ class ComponentTool(BaseTool):
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareProtected
(
Permissions
.
ResetDynamicClasses
,
'reset'
)
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
XXX-arnau: global reset
"""
"""
...
@@ -115,4 +115,5 @@ class ComponentTool(BaseTool):
...
@@ -115,4 +115,5 @@ class ComponentTool(BaseTool):
key
=
'ComponentTool.resetOnceAtTransactionBoundary'
key
=
'ComponentTool.resetOnceAtTransactionBoundary'
if
key
not
in
tv
:
if
key
not
in
tv
:
tv
[
key
]
=
None
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):
...
@@ -1254,7 +1254,7 @@ class _TestZodbComponent(SecurityTestCase):
self
.
_component_tool
=
self
.
getPortal
().
portal_components
self
.
_component_tool
=
self
.
getPortal
().
portal_components
self
.
_module
=
__import__
(
self
.
_getComponentModuleName
(),
self
.
_module
=
__import__
(
self
.
_getComponentModuleName
(),
fromlist
=
[
'erp5.component'
])
fromlist
=
[
'erp5.component'
])
self
.
_component_tool
.
reset
()
self
.
_component_tool
.
reset
(
force
=
True
,
reset_portal_type
=
True
)
@
abc
.
abstractmethod
@
abc
.
abstractmethod
def
_newComponent
(
self
,
reference
,
text_content
,
version
=
'erp5'
):
def
_newComponent
(
self
,
reference
,
text_content
,
version
=
'erp5'
):
...
@@ -1362,7 +1362,7 @@ class _TestZodbComponent(SecurityTestCase):
...
@@ -1362,7 +1362,7 @@ class _TestZodbComponent(SecurityTestCase):
self
.
assertEquals
(
error_message
,
error_list
[
0
])
self
.
assertEquals
(
error_message
,
error_list
[
0
])
self
.
assertEquals
(
component
.
getReference
(),
invalid_reference
)
self
.
assertEquals
(
component
.
getReference
(),
invalid_reference
)
self
.
assertEquals
(
component
.
getReference
(
validated_only
=
True
),
valid_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
)
self
.
assertModuleImportable
(
valid_reference
)
ComponentTool
.
reset
=
assertResetCalled
ComponentTool
.
reset
=
assertResetCalled
...
@@ -1430,7 +1430,7 @@ class _TestZodbComponent(SecurityTestCase):
...
@@ -1430,7 +1430,7 @@ class _TestZodbComponent(SecurityTestCase):
self
.
assertEquals
(
error_message
,
error_list
[
0
])
self
.
assertEquals
(
error_message
,
error_list
[
0
])
self
.
assertEquals
(
component
.
getVersion
(),
invalid_version
)
self
.
assertEquals
(
component
.
getVersion
(),
invalid_version
)
self
.
assertEquals
(
component
.
getVersion
(
validated_only
=
True
),
valid_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
)
self
.
assertModuleImportable
(
reference
)
ComponentTool
.
reset
=
assertResetCalled
ComponentTool
.
reset
=
assertResetCalled
...
@@ -1495,7 +1495,7 @@ class _TestZodbComponent(SecurityTestCase):
...
@@ -1495,7 +1495,7 @@ class _TestZodbComponent(SecurityTestCase):
self
.
assertTrue
(
error_list
[
0
].
startswith
(
error_message
))
self
.
assertTrue
(
error_list
[
0
].
startswith
(
error_message
))
self
.
assertEquals
(
component
.
getTextContent
(),
invalid_code
)
self
.
assertEquals
(
component
.
getTextContent
(),
invalid_code
)
self
.
assertEquals
(
component
.
getTextContent
(
validated_only
=
True
),
valid_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'
)
self
.
assertModuleImportable
(
'TestComponentWithSyntaxError'
)
ComponentTool
.
reset
=
assertResetCalled
ComponentTool
.
reset
=
assertResetCalled
...
@@ -1780,7 +1780,7 @@ class TestPortalType(Person):
...
@@ -1780,7 +1780,7 @@ class TestPortalType(Person):
self
.
assertFalse
(
self
.
_module
.
TestPortalType
in
person
.
__class__
.
mro
())
self
.
assertFalse
(
self
.
_module
.
TestPortalType
in
person
.
__class__
.
mro
())
# Reset Portal Type classes to ghost to make sure that everything is reset
# 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
# TestPortalType must be in available type class list
self
.
assertTrue
(
'TestPortalType'
in
person_type
.
getDocumentTypeList
())
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