summaryrefslogtreecommitdiff
path: root/sleekxmpp/basexmpp.py
diff options
context:
space:
mode:
authorBrian Beggs <macdiesel@gmail.com>2010-06-02 20:45:42 +0800
committerThom Nichols <tmnichols@gmail.com>2010-06-03 01:29:49 +0800
commit2a43f59a588af7206b0d1935e85fbb9577b3c200 (patch)
tree9e8bce393421404345c07476c502d730e9aabb5b /sleekxmpp/basexmpp.py
parent184f7cb8a4d2835c317eca7db129fb06d92a336a (diff)
downloadslixmpp-2a43f59a588af7206b0d1935e85fbb9577b3c200.tar.gz
slixmpp-2a43f59a588af7206b0d1935e85fbb9577b3c200.tar.bz2
slixmpp-2a43f59a588af7206b0d1935e85fbb9577b3c200.tar.xz
slixmpp-2a43f59a588af7206b0d1935e85fbb9577b3c200.zip
added try/catch block to plugin loading
Diffstat (limited to 'sleekxmpp/basexmpp.py')
-rw-r--r--sleekxmpp/basexmpp.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index 5f330176..b78c255c 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -97,18 +97,21 @@ class basexmpp(object):
# discover relative "path" to the plugins module from the main app, and import it.
# TODO:
# gross, this probably isn't necessary anymore, especially for an installed module
- if pluginModule:
- module = __import__("%s.%s" % (pluginModule, plugin), globals(), locals(), [plugin])
- else:
- module = __import__("%s.%s" % (globals()['plugins'].__name__, plugin), globals(), locals(), [plugin])
- # init the plugin class
- self.plugin[plugin] = getattr(module, plugin)(self, pconfig) # eek
- # all of this for a nice debug? sure.
- xep = ''
- if hasattr(self.plugin[plugin], 'xep'):
- xep = "(XEP-%s) " % self.plugin[plugin].xep
- logging.debug("Loaded Plugin %s%s" % (xep, self.plugin[plugin].description))
-
+ try:
+ if pluginModule:
+ module = __import__(pluginModule, globals(), locals(), [plugin])
+ else:
+ module = __import__("%s.%s" % (globals()['plugins'].__name__, plugin), globals(), locals(), [plugin])
+ # init the plugin class
+ self.plugin[plugin] = getattr(module, plugin)(self, pconfig) # eek
+ # all of this for a nice debug? sure.
+ xep = ''
+ if hasattr(self.plugin[plugin], 'xep'):
+ xep = "(XEP-%s) " % self.plugin[plugin].xep
+ logging.debug("Loaded Plugin %s%s" % (xep, self.plugin[plugin].description))
+ except:
+ logging.error("Unable to load plugin: %s" %(plugin) )
+
def register_plugins(self):
"""Initiates all plugins in the plugins/__init__.__all__"""
if self.plugin_whitelist: