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
Labels
Merge Requests
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
124b1619
Commit
124b1619
authored
Nov 17, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure automatic migration of core tools does not modify ZODB when if fails
parent
5b8ec677
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
26 deletions
+35
-26
product/ERP5Type/dynamic/portal_type_class.py
product/ERP5Type/dynamic/portal_type_class.py
+35
-26
No files found.
product/ERP5Type/dynamic/portal_type_class.py
View file @
124b1619
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
import
sys
import
sys
import
os
import
os
import
inspect
import
inspect
import
transaction
from
types
import
ModuleType
from
types
import
ModuleType
from
Products.ERP5Type.dynamic.dynamic_module
import
registerDynamicModule
from
Products.ERP5Type.dynamic.dynamic_module
import
registerDynamicModule
...
@@ -42,7 +43,7 @@ from Products.ERP5Type.dynamic.accessor_holder import AccessorHolderModuleType,
...
@@ -42,7 +43,7 @@ from Products.ERP5Type.dynamic.accessor_holder import AccessorHolderModuleType,
createAllAccessorHolderList
createAllAccessorHolderList
from
Products.ERP5Type.TransactionalVariable
import
TransactionalResource
from
Products.ERP5Type.TransactionalVariable
import
TransactionalResource
from
zLOG
import
LOG
,
ERROR
,
INFO
,
WARNING
from
zLOG
import
LOG
,
ERROR
,
INFO
,
WARNING
,
PANIC
def
_importClass
(
classpath
):
def
_importClass
(
classpath
):
try
:
try
:
...
@@ -346,6 +347,7 @@ def synchronizeDynamicModules(context, force=False):
...
@@ -346,6 +347,7 @@ def synchronizeDynamicModules(context, force=False):
migrate
=
False
migrate
=
False
from
Products.ERP5Type.Tool.PropertySheetTool
import
PropertySheetTool
from
Products.ERP5Type.Tool.PropertySheetTool
import
PropertySheetTool
from
Products.ERP5Type.Tool.TypesTool
import
TypesTool
from
Products.ERP5Type.Tool.TypesTool
import
TypesTool
try
:
for
tool_class
in
TypesTool
,
PropertySheetTool
:
for
tool_class
in
TypesTool
,
PropertySheetTool
:
# if the instance has no property sheet tool, or incomplete
# if the instance has no property sheet tool, or incomplete
# property sheets, we need to import some data to bootstrap
# property sheets, we need to import some data to bootstrap
...
@@ -354,7 +356,8 @@ def synchronizeDynamicModules(context, force=False):
...
@@ -354,7 +356,8 @@ def synchronizeDynamicModules(context, force=False):
tool
=
getattr
(
portal
,
tool_id
,
None
)
tool
=
getattr
(
portal
,
tool_id
,
None
)
if
tool
is
None
:
if
tool
is
None
:
tool
=
tool_class
()
tool
=
tool_class
()
portal
.
_setObject
(
tool_id
,
tool
,
set_owner
=
False
,
suppress_events
=
True
)
portal
.
_setObject
(
tool_id
,
tool
,
set_owner
=
False
,
suppress_events
=
True
)
tool
=
getattr
(
portal
,
tool_id
)
tool
=
getattr
(
portal
,
tool_id
)
elif
tool
.
_isBootstrapRequired
():
elif
tool
.
_isBootstrapRequired
():
migrate
=
True
migrate
=
True
...
@@ -372,6 +375,12 @@ def synchronizeDynamicModules(context, force=False):
...
@@ -372,6 +375,12 @@ def synchronizeDynamicModules(context, force=False):
' business templates'
)
' business templates'
)
else
:
else
:
_bootstrapped
.
add
(
portal
.
id
)
_bootstrapped
.
add
(
portal
.
id
)
except
:
# Required because the exception may be silently dropped by the caller.
transaction
.
doom
()
LOG
(
'ERP5Site'
,
PANIC
,
"Automatic migration of type and"
" property sheet tool failed"
,
error
=
sys
.
exc_info
())
raise
LOG
(
"ERP5Type.dynamic"
,
0
,
"Resetting dynamic classes"
)
LOG
(
"ERP5Type.dynamic"
,
0
,
"Resetting dynamic classes"
)
try
:
try
:
...
...
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