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
Paul Graydon
erp5
Commits
f60aa262
Commit
f60aa262
authored
Apr 27, 2022
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py3: ZODB Components: New Exception ModuleNotFoundError which avoids a hack in Python2.
parent
0b9ecdd7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
product/ERP5Type/dynamic/component_package.py
product/ERP5Type/dynamic/component_package.py
+9
-1
No files found.
product/ERP5Type/dynamic/component_package.py
View file @
f60aa262
...
@@ -51,6 +51,12 @@ class ComponentVersionPackage(ModuleType):
...
@@ -51,6 +51,12 @@ class ComponentVersionPackage(ModuleType):
"""
"""
__path__
=
[]
__path__
=
[]
try
:
ModuleNotFoundError
except
NameError
:
# < 3.6
class
ModuleNotFoundError
(
ImportError
):
pass
class
ComponentDynamicPackage
(
ModuleType
):
class
ComponentDynamicPackage
(
ModuleType
):
"""
"""
A top-level component is a package as it contains modules, this is required
A top-level component is a package as it contains modules, this is required
...
@@ -420,8 +426,10 @@ class ComponentDynamicPackage(ModuleType):
...
@@ -420,8 +426,10 @@ class ComponentDynamicPackage(ModuleType):
# load_module(), and returning module 'name' in contrary to __import__
# load_module(), and returning module 'name' in contrary to __import__
# returning 'erp5' (requiring fromlist parameter which is slower)
# returning 'erp5' (requiring fromlist parameter which is slower)
return
import_module
(
fullname
)
return
import_module
(
fullname
)
except
ModuleNotFoundError
:
pass
except
ImportError
as
e
:
except
ImportError
as
e
:
if
str
(
e
)
!=
"No module named "
+
name
:
if
s
ix
.
PY3
or
s
tr
(
e
)
!=
"No module named "
+
name
:
LOG
(
"ERP5Type.dynamic"
,
WARNING
,
LOG
(
"ERP5Type.dynamic"
,
WARNING
,
"Could not load Component module %r"
%
fullname
,
error
=
True
)
"Could not load Component module %r"
%
fullname
,
error
=
True
)
...
...
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