Commit 18bdbccd authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

py2/py3: fix fromlist for __import__().

With fromlist='erp5.component.extention' (that should be ['erp5.component.extention']), it works in Python 2.
But in Python 3, we have an exception like:
  ModuleNotFoundError: No module named 'erp5.component.extension.erp5_version.InventoryBrain.'
With just fromlist=[''], like we do in XMLSyncUtils, it works on both Python 2 and Python 3.
parent 4b2bccdd
......@@ -279,7 +279,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')
{}, [''])
o = getattr(m, name, None)
if o is None:
......
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