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:
Lance Stout 2012-05-04 09:51:02 -07:00
parent a9acff5294
commit 97a7be7dfa

View file

@ -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):