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
1 changed files with 7 additions and 1 deletions
|
@ -18,6 +18,10 @@ import logging
|
|||
import threading
|
||||
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
unicode = str
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -84,9 +88,11 @@ def load_plugin(name, module=None):
|
|||
module = 'sleekxmpp.features.%s' % name
|
||||
__import__(module)
|
||||
mod = sys.modules[module]
|
||||
else:
|
||||
elif isinstance(module, (str, unicode)):
|
||||
__import__(module)
|
||||
mod = sys.modules[module]
|
||||
else:
|
||||
mod = module
|
||||
|
||||
# Add older style plugins to the registry.
|
||||
if hasattr(mod, name):
|
||||
|
|
Loading…
Reference in a new issue