diff options
author | Lance Stout <lancestout@gmail.com> | 2012-05-04 09:51:02 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-05-04 09:51:02 -0700 |
commit | 97a7be7dfaa013d039886d01a0d81d1e614b17d1 (patch) | |
tree | 48e7c06d6678d684336a0baf90ac08875ca2dd7c /sleekxmpp | |
parent | a9acff5294fa6c349d113236de07d0e8dae186a1 (diff) | |
download | slixmpp-97a7be7dfaa013d039886d01a0d81d1e614b17d1.tar.gz slixmpp-97a7be7dfaa013d039886d01a0d81d1e614b17d1.tar.bz2 slixmpp-97a7be7dfaa013d039886d01a0d81d1e614b17d1.tar.xz slixmpp-97a7be7dfaa013d039886d01a0d81d1e614b17d1.zip |
Fix loading plugins from custom modules when passing the module itself.
Loading plugins from custom modules when passed as a string still works.
Diffstat (limited to 'sleekxmpp')
-rw-r--r-- | sleekxmpp/plugins/base.py | 8 |
1 files changed, 7 insertions, 1 deletions
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): |