diff options
-rw-r--r-- | module/plugins/internal/SimpleCrypter.py | 7 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 19 |
2 files changed, 17 insertions, 9 deletions
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 61286449d..9e1b11f7b 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -7,7 +7,7 @@ from traceback import print_exc from module.network.RequestFactory import getURL from module.plugins.Crypter import Crypter from module.plugins.Plugin import Fail -from module.plugins.internal.SimpleHoster import replace_patterns, set_cookies +from module.plugins.internal.SimpleHoster import _error, replace_patterns, set_cookies from module.utils import fixup, html_unescape @@ -164,8 +164,5 @@ class SimpleCrypter(Crypter): self.package_links += self.getLinks() - #@TODO: remove in 0.4.10 def error(self, reason="", type="parse"): - if self.core.debug: - print_exc() - raise Fail("%s error%s | Plugin may be out of date" % (type.strip().capitalize(), ': ' + reason.strip() if reason else "")) + return _error(reason, type) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 135d3c9d9..84a77a312 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -13,6 +13,20 @@ from module.plugins.Plugin import Fail from module.utils import fixup, html_unescape, parseFileSize +#@TODO: Remove in 0.4.10 and redirect to self.error instead +def _error(self, reason="", type=""): + if not reason and not type: + type = "unknown" + + msg = _("%s error") % type.strip().capitalize() if type else _("Error") + msg += ": " + reason.strip() if reason else "" + msg += _(" | Plugin may be out of date") + + if self.core.debug: + print_exc() + raise Fail(msg) + + def replace_patterns(string, ruleslist): for r in ruleslist: rf, rt = r @@ -324,8 +338,5 @@ class SimpleHoster(Hoster): super(SimpleHoster, self).wait() - #@TODO: remove in 0.4.10 def error(self, reason="", type="parse"): - if self.core.debug: - print_exc() - raise Fail("%s error%s | Plugin may be out of date" % (type.strip().capitalize(), ': ' + reason.strip() if reason else "")) + return _error(reason, type) |