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
1
Issues
1
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
Roque
erp5
Commits
ec21a348
Commit
ec21a348
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
12e8b5ba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
product/ERP5Type/dynamic/component_package.py
product/ERP5Type/dynamic/component_package.py
+10
-1
No files found.
product/ERP5Type/dynamic/component_package.py
View file @
ec21a348
...
...
@@ -30,6 +30,7 @@
# There is absolutely no reason to use relative imports when loading a Component
from
__future__
import
absolute_import
import
six
import
sys
import
imp
import
collections
...
...
@@ -51,6 +52,12 @@ class ComponentVersionPackage(ModuleType):
"""
__path__
=
[]
try
:
ModuleNotFoundError
except
NameError
:
# < 3.6
class
ModuleNotFoundError
(
ImportError
):
pass
class
ComponentDynamicPackage
(
ModuleType
):
"""
A top-level component is a package as it contains modules, this is required
...
...
@@ -420,8 +427,10 @@ class ComponentDynamicPackage(ModuleType):
# load_module(), and returning module 'name' in contrary to __import__
# returning 'erp5' (requiring fromlist parameter which is slower)
return
import_module
(
fullname
)
except
ModuleNotFoundError
:
pass
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
,
"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