diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-11-12 01:52:08 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-11-12 01:52:08 +0100 |
commit | ff0e1a28ce6ac27d11cea7cceaeb50a779facafb (patch) | |
tree | 40b475033cc7bb277346b2ef57786031b04aaacd /module/plugins | |
parent | [Captcha9kw] Code improvements (diff) | |
download | pyload-ff0e1a28ce6ac27d11cea7cceaeb50a779facafb.tar.xz |
[Plugin] Save reason as pyfile.error when fails
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/Plugin.py | 16 | ||||
-rw-r--r-- | module/plugins/PluginManager.py | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index d21bbb196..d1227eb29 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -351,7 +351,9 @@ class Plugin(Base): def abort(self, reason=""): """ abort and give reason """ - raise Abort + if reason: + self.pyfile.error = str(reason) + raise Abort #@TODO: Use raise Abort(reason) in 0.4.10 def error(self, reason="", type=""): @@ -365,14 +367,18 @@ class Plugin(Base): raise Fail(msg) - def offline(self): + def offline(self, reason=""): """ fail and indicate file is offline """ - raise Fail("offline") + if reason: + self.pyfile.error = str(reason) + raise Fail("offline") #@TODO: Use raise Fail("offline", reason) in 0.4.10 - def tempOffline(self): + def tempOffline(self, reason=""): """ fail and indicates file ist temporary offline, the core may take consequences """ - raise Fail("temp. offline") + if reason: + self.pyfile.error = str(reason) + raise Fail("temp. offline") #@TODO: Use raise Fail("temp. offline", reason) in 0.4.10 def retry(self, max_tries=5, wait_time=1, reason=""): diff --git a/module/plugins/PluginManager.py b/module/plugins/PluginManager.py index df22b69e7..78b5a9337 100644 --- a/module/plugins/PluginManager.py +++ b/module/plugins/PluginManager.py @@ -43,7 +43,7 @@ class PluginManager: sys.path.append(abspath("")) - #@NOTE: In 0.4.10 directory "accounts" changes to "account" and "hooks" changes to "hook" + #@NOTE: In 0.4.10 directory "accounts" changes to "account" and "hooks" changes to "addon" self.plugins['accounts'] = self.accountPlugins = self.parse("accounts") self.plugins['hooks'] = self.hookPlugins = self.parse("hooks") |