summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-12-28 08:15:40 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-12-28 08:15:40 +0100
commit9076d20c7bb18cd73466096b20ddfefea28088ef (patch)
tree76aafabea9d3859dbb4ba2789cedb5e42df6d3ce /module/plugins
parentFix password sharing issue (diff)
downloadpyload-9076d20c7bb18cd73466096b20ddfefea28088ef.tar.xz
Spare code fixes
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/internal/Account.py2
-rw-r--r--module/plugins/internal/Base.py2
-rw-r--r--module/plugins/internal/Plugin.py9
-rw-r--r--module/plugins/internal/misc.py2
4 files changed, 9 insertions, 6 deletions
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index e89d1af7d..ec226956f 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -6,7 +6,7 @@ import threading
import time
from module.plugins.internal.Plugin import Plugin, Skip
-from module.plugins.internal.misc import Periodical, compare_time, isiterable, lock, parse_size
+from module.plugins.internal.misc import Periodical, compare_time, decode, isiterable, lock, parse_size
class Account(Plugin):
diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py
index 3fa0e40d2..3d0bed791 100644
--- a/module/plugins/internal/Base.py
+++ b/module/plugins/internal/Base.py
@@ -9,7 +9,7 @@ import urlparse
from module.plugins.internal.Captcha import Captcha
from module.plugins.internal.Plugin import Plugin, Abort, Fail, Reconnect, Retry, Skip
from module.plugins.internal.misc import (decode, encode, fixurl, format_size, format_time,
- parse_html_form, parse_name, replace_patterns)
+ parse_html_form, parse_name, replace_patterns)
#@TODO: Recheck in 0.4.10
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 9357ea8fb..aa6e90db3 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -18,8 +18,9 @@ except ImportError:
import module.plugins.internal.misc as utils
+from module.network.RequestFactory import getRequest as get_request
from module.plugins.Plugin import Abort, Fail, Reconnect, Retry, SkipDownload as Skip #@TODO: Remove in 0.4.10
-from module.plugins.internal.misc import * #@NOTE: Don't use `*`
+from module.plugins.internal.misc import Config, DB, decode, encode, fixurl, format_exc, parse_html_header
class Plugin(object):
@@ -119,7 +120,6 @@ class Plugin(object):
del frame
- #@TODO: Move to misc
def remove(self, path, trash=False): #@TODO: Change to `trash=True` in 0.4.10
try:
remove(path, trash)
@@ -181,7 +181,10 @@ class Plugin(object):
url = fixurl(url, unquote=True) #: Recheck in 0.4.10
- if req is None:
+ if req is False:
+ req = get_request()
+
+ elif not req:
req = self.req
#@TODO: Move to network in 0.4.10
diff --git a/module/plugins/internal/misc.py b/module/plugins/internal/misc.py
index 50b9ec641..ed5fb8693 100644
--- a/module/plugins/internal/misc.py
+++ b/module/plugins/internal/misc.py
@@ -379,7 +379,7 @@ def encode(value, encoding='utf-8', errors='backslashreplace'):
if encoding == decoding:
res = value
else:
- res = transcode(decoding, encoding)
+ res = transcode(value, decoding, encoding)
else:
res = str(value)