From a0e2459f2d1506912ac4a5d0c330c8dae01a4768 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 00:28:18 +0200 Subject: Improve fixurl method --- module/plugins/internal/Plugin.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'module/plugins/internal/Plugin.py') diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index 51f952b40..93dd2ecbe 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -11,6 +11,11 @@ from module.plugins.Plugin import Abort, Fail, Reconnect, Retry, SkipDownload as from module.utils import fs_encode, fs_decode, html_unescape, save_join as fs_join +#@TODO: Move to utils in 0.4.10 +def fixurl(url): + return html_unescape(urllib.unquote(url.decode('unicode-escape'))).strip() + + #@TODO: Move to utils in 0.4.10 def timestamp(): return int(time.time() * 1000) @@ -256,10 +261,6 @@ class Plugin(object): raise Fail(msg) - def fixurl(self, url): - return html_unescape(urllib.unquote(url.decode('unicode-escape'))).strip() - - def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=True, multipart=True, req=None): """ Load content at url and returns it @@ -276,7 +277,7 @@ class Plugin(object): if hasattr(self, 'pyfile') and self.pyfile.abort: self.abort() - url = self.fixurl(url) + url = fixurl(url) if not url or not isinstance(url, basestring): self.fail(_("No url given")) -- cgit v1.2.3