From faec86b3be38756510fb3534c7615db75ecd53b7 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Sun, 17 Oct 2010 15:47:24 -0400 Subject: Import plugins from string referenced modules. --- sleekxmpp/basexmpp.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index 78ecec33..3db29a9a 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -176,6 +176,10 @@ class BaseXMPP(XMLStream): module = sleekxmpp.plugins module = __import__("%s.%s" % (module.__name__, plugin), globals(), locals(), [plugin]) + if isinstance(module, str): + # We probably want to load a module from outside + # the sleekxmpp package, so leave out the globals(). + module = __import__(module, fromlist=[plugin]) # Load the plugin class from the module. self.plugin[plugin] = getattr(module, plugin)(self, pconfig) -- cgit v1.2.3