summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-30 17:21:54 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-30 17:21:54 +0100
commit2c7d777216d36c13403867d37f4a584676990502 (patch)
treef8e297c80275ddfe6e80dbdc9a3cefa3b63eea66
parentImprove loadAccountInfo stuff (diff)
downloadpyload-2c7d777216d36c13403867d37f4a584676990502.tar.xz
[Plugin] Improve debug logging of load and download methods + url striping
-rw-r--r--module/plugins/Plugin.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index be2c14811..241c2c12a 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -180,7 +180,9 @@ class Plugin(Base):
#: username/login
self.user = None
- if self.account and not self.account.canUse(): self.account = None
+ if self.account and not self.account.canUse():
+ self.account = None
+
if self.account:
self.user, data = self.account.selectAccount()
#: Browser instance, see `network.Browser`
@@ -446,14 +448,16 @@ class Plugin(Base):
:param decode: Wether to decode the output according to http header, should be True in most cases
:return: Loaded content
"""
- if self.pyfile.abort: raise Abort
+ if self.pyfile.abort:
+ raise Abort
+
+ url = url.strip()
#utf8 vs decode -> please use decode attribute in all future plugins
if type(url) == unicode:
url = str(url) # encode('utf8')
if self.core.debug:
- kwargs = locals()
- self.logDebug("Load url: " + kwargs['url'], *["%s=%s" % (key, val) for key, val in kwargs.iteritems() if key not in ("self", "url")])
+ self.logDebug("Load url: " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")])
res = self.req.load(url, get, post, ref, cookies, just_header, decode=decode)
@@ -512,10 +516,13 @@ class Plugin(Base):
the filename will be changed if needed
:return: The location where the file was saved
"""
+ if self.pyfile.abort:
+ raise Abort
+
+ url = url.strip()
if self.core.debug:
- kwargs = locals()
- self.logDebug("Download url: " + kwargs['url'], *["%s=%s" % (key, val) for key, val in kwargs.iteritems() if key not in ("self", "url")])
+ self.logDebug("Download url: " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")])
self.checkForSameFiles()