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
Leo Le Bouter
erp5
Commits
76616135
Commit
76616135
authored
Jul 04, 2013
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZODB Components: Avoid masking exceptions as much as possible when loading a Component.
parent
0c9c1a45
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
13 deletions
+24
-13
product/ERP5Type/dynamic/portal_type_class.py
product/ERP5Type/dynamic/portal_type_class.py
+17
-7
product/ERP5Type/patches/ExternalMethod.py
product/ERP5Type/patches/ExternalMethod.py
+7
-6
No files found.
product/ERP5Type/dynamic/portal_type_class.py
View file @
76616135
...
@@ -193,13 +193,23 @@ def generatePortalTypeClass(site, portal_type_name):
...
@@ -193,13 +193,23 @@ def generatePortalTypeClass(site, portal_type_name):
type_class_namespace
=
document_class_registry
.
get
(
type_class
,
''
)
type_class_namespace
=
document_class_registry
.
get
(
type_class
,
''
)
if
not
(
type_class_namespace
.
startswith
(
'Products.ERP5Type'
)
or
if
not
(
type_class_namespace
.
startswith
(
'Products.ERP5Type'
)
or
portal_type_name
in
core_portal_type_class_dict
):
portal_type_name
in
core_portal_type_class_dict
):
try
:
import
erp5.component.document
klass
=
getattr
(
__import__
(
'erp5.component.document.'
+
type_class
,
module_fullname
=
'erp5.component.document.'
+
type_class
fromlist
=
[
'erp5.component.document'
],
module_loader
=
erp5
.
component
.
document
.
find_module
(
module_fullname
)
level
=
0
),
if
module_loader
is
not
None
:
type_class
)
try
:
except
(
ImportError
,
AttributeError
):
module
=
module_loader
.
load_module
(
module_fullname
)
pass
except
ImportError
,
e
:
LOG
(
"ERP5Type.dynamic"
,
WARNING
,
"Could not load Component module '%s': %s"
%
(
module_fullname
,
e
))
else
:
try
:
klass
=
getattr
(
module
,
type_class
)
except
AttributeError
:
LOG
(
"ERP5Type.dynamic"
,
WARNING
,
"Could not get class '%s' in Component module '%s'"
%
\
(
type_class
,
module_fullname
))
if
klass
is
None
:
if
klass
is
None
:
type_class_path
=
document_class_registry
.
get
(
type_class
)
type_class_path
=
document_class_registry
.
get
(
type_class
)
...
...
product/ERP5Type/patches/ExternalMethod.py
View file @
76616135
...
@@ -70,12 +70,10 @@ if 1:
...
@@ -70,12 +70,10 @@ if 1:
from kw.
from kw.
"""
"""
try
:
try
:
f
=
getattr
(
__import__
(
'erp5.component.extension.'
+
self
.
_module
,
component_module
=
__import__
(
'erp5.component.extension.'
+
self
.
_module
,
fromlist
=
[
'erp5.component.extension'
],
fromlist
=
[
'erp5.component.extension'
],
level
=
0
),
level
=
0
)
self
.
_function
)
except
ImportError
:
except
(
ImportError
,
AttributeError
):
import
Globals
# for data
import
Globals
# for data
filePath
=
self
.
filepath
()
filePath
=
self
.
filepath
()
...
@@ -93,6 +91,9 @@ if 1:
...
@@ -93,6 +91,9 @@ if 1:
self
.
reloadIfChanged
()
self
.
reloadIfChanged
()
f
=
None
f
=
None
else
:
f
=
getattr
(
component_module
,
self
.
_function
)
_v_f
=
getattr
(
self
,
'_v_f'
,
None
)
_v_f
=
getattr
(
self
,
'_v_f'
,
None
)
if
not
_v_f
or
(
f
and
f
is
not
_v_f
):
if
not
_v_f
or
(
f
and
f
is
not
_v_f
):
f
=
self
.
getFunction
(
f
=
f
)
f
=
self
.
getFunction
(
f
=
f
)
...
...
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