Add some comments to make things clearer.

This commit is contained in:
Raoul Snyman 2013-02-11 11:43:26 +02:00
parent 230c06c83c
commit a2125e0954

View File

@ -93,9 +93,12 @@ class PluginManager(object):
# import the modules # import the modules
log.debug(u'Importing %s from %s. Depth %d', module_name, root, this_depth) log.debug(u'Importing %s from %s. Depth %d', module_name, root, this_depth)
try: try:
# Use the "imp" library to try to get around a problem with the PyUNO library which
# monkey-patches the __import__ function to do some magic. This causes issues with our tests.
# First, try to find the module we want to import, searching the directory in ``root``
fp, path_name, description = imp.find_module(module_name, [root]) fp, path_name, description = imp.find_module(module_name, [root])
# Then load the module (do the actual import) using the details from ``find_module()``
imp.load_module(module_name, fp, path_name, description) imp.load_module(module_name, fp, path_name, description)
#__import__(module_name, globals(), locals(), [])
except ImportError, e: except ImportError, e:
log.exception(u'Failed to import module %s on path %s for reason %s', log.exception(u'Failed to import module %s on path %s for reason %s',
module_name, path, e.args[0]) module_name, path, e.args[0])