From 97a7be7dfaa013d039886d01a0d81d1e614b17d1 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Fri, 4 May 2012 09:51:02 -0700 Subject: Fix loading plugins from custom modules when passing the module itself. Loading plugins from custom modules when passed as a string still works. --- sleekxmpp/plugins/base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sleekxmpp/plugins/base.py b/sleekxmpp/plugins/base.py index fabee50d..9a7e1b19 100644 --- a/sleekxmpp/plugins/base.py +++ b/sleekxmpp/plugins/base.py @@ -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): -- cgit v1.2.3