Commit 81437738 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Arnaud Fontaine

py2/py3: change fromlist for __import__() in Python 3.

parent 01c5e7ae
......@@ -31,6 +31,7 @@ from zLOG import LOG, INFO, ERROR
from io import BytesIO
from Products.ERP5Type import Permissions
from Products.ERP5Type.Utils import str2bytes
import six
security = ClassSecurityInfo()
DA.security = security
......@@ -282,7 +283,7 @@ def getObjectMeta(original_function):
# imported, which is enough to use a ZODB Extension as a brain.
try:
m = __import__('erp5.component.extension.%s' % module, globals(),
{}, 'erp5.component.extension')
{}, ['erp5.component.extension'] if six.PY2 else ['erp5'])
o = getattr(m, name, None)
if o is None:
......
......@@ -300,7 +300,7 @@ class ERP5TypeTestLoader(unittest.TestLoader):
def _importZodbTestComponent(self, name):
import erp5.component.test
module = __import__('erp5.component.test.' + name,
fromlist=['erp5.component.test'],
fromlist=['erp5.component.test'] if six.PY2 else ['erp5'],
level=0)
try:
self._test_component_ref_list.append(module)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment