mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-12-22 19:17:30 +00:00
added try/catch block to plugin loading
This commit is contained in:
parent
c0457cf5d0
commit
b0066f3ef4
1 changed files with 15 additions and 12 deletions
|
@ -97,17 +97,20 @@ class basexmpp(object):
|
||||||
# discover relative "path" to the plugins module from the main app, and import it.
|
# discover relative "path" to the plugins module from the main app, and import it.
|
||||||
# TODO:
|
# TODO:
|
||||||
# gross, this probably isn't necessary anymore, especially for an installed module
|
# gross, this probably isn't necessary anymore, especially for an installed module
|
||||||
if pluginModule:
|
try:
|
||||||
module = __import__("%s.%s" % (pluginModule, plugin), globals(), locals(), [plugin])
|
if pluginModule:
|
||||||
else:
|
module = __import__(pluginModule, globals(), locals(), [plugin])
|
||||||
module = __import__("%s.%s" % (globals()['plugins'].__name__, plugin), globals(), locals(), [plugin])
|
else:
|
||||||
# init the plugin class
|
module = __import__("%s.%s" % (globals()['plugins'].__name__, plugin), globals(), locals(), [plugin])
|
||||||
self.plugin[plugin] = getattr(module, plugin)(self, pconfig) # eek
|
# init the plugin class
|
||||||
# all of this for a nice debug? sure.
|
self.plugin[plugin] = getattr(module, plugin)(self, pconfig) # eek
|
||||||
xep = ''
|
# all of this for a nice debug? sure.
|
||||||
if hasattr(self.plugin[plugin], 'xep'):
|
xep = ''
|
||||||
xep = "(XEP-%s) " % self.plugin[plugin].xep
|
if hasattr(self.plugin[plugin], 'xep'):
|
||||||
logging.debug("Loaded Plugin %s%s" % (xep, self.plugin[plugin].description))
|
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):
|
def register_plugins(self):
|
||||||
"""Initiates all plugins in the plugins/__init__.__all__"""
|
"""Initiates all plugins in the plugins/__init__.__all__"""
|
||||||
|
|
Loading…
Reference in a new issue