Fix loading plugins from custom modules when passing the module itself.
Loading plugins from custom modules when passed as a string still works.
This commit is contained in:
parent
a9acff5294
commit
97a7be7dfa
@ -18,6 +18,10 @@ import logging
|
|||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 0):
|
||||||
|
unicode = str
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -84,9 +88,11 @@ def load_plugin(name, module=None):
|
|||||||
module = 'sleekxmpp.features.%s' % name
|
module = 'sleekxmpp.features.%s' % name
|
||||||
__import__(module)
|
__import__(module)
|
||||||
mod = sys.modules[module]
|
mod = sys.modules[module]
|
||||||
else:
|
elif isinstance(module, (str, unicode)):
|
||||||
__import__(module)
|
__import__(module)
|
||||||
mod = sys.modules[module]
|
mod = sys.modules[module]
|
||||||
|
else:
|
||||||
|
mod = module
|
||||||
|
|
||||||
# Add older style plugins to the registry.
|
# Add older style plugins to the registry.
|
||||||
if hasattr(mod, name):
|
if hasattr(mod, name):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user