diff options
Diffstat (limited to 'module/plugins')
| -rw-r--r-- | module/plugins/Plugin.py | 6 | ||||
| -rw-r--r-- | module/plugins/internal/SimpleCrypter.py | 15 | ||||
| -rw-r--r-- | module/plugins/internal/SimpleHoster.py | 9 | 
3 files changed, 20 insertions, 10 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 57da4d114..83571345c 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -13,6 +13,7 @@ if os.name != "nt":      from grp import getgrnam  from itertools import islice +from traceback import print_exc  from module.utils import save_join, save_path, fs_encode, fs_decode @@ -284,6 +285,11 @@ class Plugin(Base):          """ fail and give reason """          raise Fail(reason) +    def error(self, reason=None, type="parse"): +        raise Fail("%s error%s | Plugin out of date" % (type.capitalize(), ':' + str(reason) if reason else "")) +        if self.core.debug: +            print_exc() +      def offline(self):          """ fail and indicate file is offline """          raise Fail("offline") diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index e2e08bb1b..2ea8d302b 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -2,6 +2,8 @@  import re +from traceback import print_exc +  from module.network.RequestFactory import getURL  from module.plugins.Crypter import Crypter  from module.plugins.Plugin import Fail @@ -12,7 +14,7 @@ from module.utils import fixup, html_unescape  class SimpleCrypter(Crypter):      __name__ = "SimpleCrypter"      __type__ = "crypter" -    __version__ = "0.18" +    __version__ = "0.19"      __pattern__ = None @@ -65,6 +67,7 @@ class SimpleCrypter(Crypter):      LOGIN_PREMIUM = False +    #@TODO: remove in 0.4.10      def init(self):          account_name = (self.__name__ + ".py").replace("Folder.py", "").replace(".py", "")          account = self.core.accountManager.getAccountPlugin(account_name) @@ -128,7 +131,7 @@ class SimpleCrypter(Crypter):      def getPackageNameAndFolder(self):          if isinstance(self.TEXT_ENCODING, basestring): -            self.html = unicode(html, self.TEXT_ENCODING) +            self.html = unicode(self.html, self.TEXT_ENCODING)          if hasattr(self, 'TITLE_PATTERN'):              try: @@ -160,8 +163,8 @@ class SimpleCrypter(Crypter):              self.package_links += self.getLinks() +    #@TODO: remove in 0.4.10      def error(self, reason=None, type="parse"): -        if reason: -            raise Fail("%s error: %s | Plugin may be out of date" % (type.capitalize(), reason)) -        else: -            raise Fail("%s error | Plugin out of date" % type.capitalize()) +        raise Fail("%s error%s | Plugin out of date" % (type.capitalize(), ':' + str(reason) if reason else "")) +        if self.core.debug: +            print_exc() diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 74910692f..17543ba8d 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -3,6 +3,7 @@  import re  from time import time +from traceback import print_exc  from urlparse import urlparse  from module.network.CookieJar import CookieJar @@ -321,8 +322,8 @@ class SimpleHoster(Hoster):          super(SimpleHoster, self).wait() +    #@TODO: remove in 0.4.10      def error(self, reason=None, type="parse"): -        if reason: -            raise Fail("%s error: %s | Plugin may be out of date" % (type.capitalize(), reason)) -        else: -            raise Fail("%s error | Plugin out of date" % type.capitalize()) +        raise Fail("%s error%s | Plugin out of date" % (type.capitalize(), ':' + str(reason) if reason else "")) +        if self.core.debug: +            print_exc()  | 
