Commit 7049e668 authored by Arnaud Fontaine's avatar Arnaud Fontaine

PortalTransforms: Avoid hack to import module, instead use `fromlist` __import__ parameter.

parent 3d239ce2
...@@ -21,14 +21,7 @@ from Products.PortalTransforms.transforms.broken import BrokenTransform ...@@ -21,14 +21,7 @@ from Products.PortalTransforms.transforms.broken import BrokenTransform
def import_from_name(module_name): def import_from_name(module_name):
""" import and return a module by its name """ """ import and return a module by its name """
__traceback_info__ = (module_name, ) return __import__(module_name, {}, {}, module_name)
m = __import__(module_name)
try:
for sub in module_name.split('.')[1:]:
m = getattr(m, sub)
except AttributeError, e:
raise ImportError(str(e))
return m
def make_config_persistent(kwargs): def make_config_persistent(kwargs):
""" iterates on the given dictionnary and replace list by persistent list, """ iterates on the given dictionnary and replace list by persistent list,
......
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