diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-11-10 00:42:35 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-11-10 00:42:35 +0100 |
commit | 532b31573491c1c8d64c06ed8de23340edcd7866 (patch) | |
tree | c5de31422651e45f667d8221c99f7b2822ef60ac | |
parent | Code cosmetics (diff) | |
download | pyload-532b31573491c1c8d64c06ed8de23340edcd7866.tar.xz |
[AccountManager] Don't break pyload if account load fails
-rw-r--r-- | module/plugins/AccountManager.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py index 4ac62e602..b60375699 100644 --- a/module/plugins/AccountManager.py +++ b/module/plugins/AccountManager.py @@ -36,12 +36,20 @@ class AccountManager(): def getAccountPlugin(self, plugin): """get account instance for plugin or None if anonymous""" - if plugin in self.accounts: - if plugin not in self.plugins: - self.plugins[plugin] = self.core.pluginManager.loadClass("accounts", plugin)(self, self.accounts[plugin]) - - return self.plugins[plugin] - else: + try: + if plugin in self.accounts: + if plugin not in self.plugins: + klass = self.core.pluginManager.loadClass("accounts", plugin) + if klass: + self.plugins[plugin] = klass(self, self.accounts[plugin]) + else: + self.logCritical(_("Account plugin %s not loaded") % plugin) + raise + + return self.plugins[plugin] + else: + raise + except: return None |