diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-01-08 23:22:30 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-01-08 23:22:30 +0100 |
commit | 8d9a3826facc7f828265d5dbd036db863bfb4fc2 (patch) | |
tree | baf7e0034ac5278f2370d615a0d41da94affd676 /module | |
parent | py 2.5 compability (diff) | |
download | pyload-8d9a3826facc7f828265d5dbd036db863bfb4fc2.tar.xz |
encoding fix
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/Plugin.py | 14 | ||||
-rw-r--r-- | module/plugins/hoster/FileserveCom.py | 3 | ||||
-rw-r--r-- | module/web/ServerThread.py | 2 | ||||
-rw-r--r-- | module/web/pyload/views.py | 2 | ||||
-rw-r--r-- | module/web/templates/default/collector.html | 4 |
5 files changed, 16 insertions, 9 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 0453206cd..880b9e211 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -278,7 +278,7 @@ class Plugin(object): return result - def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, no_post_encode=False, raw_cookies={}): + def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, no_post_encode=False, raw_cookies={}, utf8=False): """ returns the content loaded """ if self.pyfile.abort: raise Abort @@ -286,6 +286,12 @@ class Plugin(object): if no_post_encode: self.log.warning("Deprecated argument no_post_encode: %s" % no_post_encode) res = self.req.load(url, get, post, ref, cookies, just_header) + + if utf8: + #@TODO parse header and decode automatically when needed + res = res.decode("utf8", "replace") + + if self.core.debug: from inspect import currentframe frame = currentframe() @@ -294,11 +300,11 @@ class Plugin(object): f = open(join("tmp", self.__name__, "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)), "wb") try: - res = res.encode("utf8") + tmp = res.encode("utf8") except: - pass + tmp = res - f.write(res) + f.write(tmp) f.close() return res diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 845e06de4..36d4b2f59 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -51,7 +51,8 @@ class FileserveCom(Hoster): self.multiDL = False
def process(self, pyfile):
- self.html = self.load(self.pyfile.url, ref=False, cookies=False if self.account else True)
+ self.html = self.load(self.pyfile.url, ref=False, cookies=False if self.account else True, utf8=True)
+
if re.search(r'<h1>File not available</h1>', self.html) is not None:
self.offline()
diff --git a/module/web/ServerThread.py b/module/web/ServerThread.py index ef70babe6..db5e3be05 100644 --- a/module/web/ServerThread.py +++ b/module/web/ServerThread.py @@ -94,8 +94,8 @@ class WebServer(threading.Thread): if not self.server in avail: - self.server = "builtin" log.warning(_("Can't use %(server)s, either python-flup or %(server)s is not installed!") % {"server": self.server}) + self.server = "builtin" if self.server == "nginx": diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py index 8246f3547..29ad90867 100644 --- a/module/web/pyload/views.py +++ b/module/web/pyload/views.py @@ -354,7 +354,7 @@ def config(request): newpw = request.POST.get("Accounts|%s|password;%s" % (pluginname, data["login"]), "").strip() time = request.POST.get("Accounts|%s|time;%s" % (pluginname, data["login"]), "").strip() - if newpw or (time and (not data["options"].has_key("time") or time != data["options"]["time"][0])): + if newpw or (time and (not data["options"].has_key("time") or [time] != data["options"]["time"])): settings.PYLOAD.update_account(pluginname, data["login"], newpw, {"time": [time]}) diff --git a/module/web/templates/default/collector.html b/module/web/templates/default/collector.html index c0ac78202..8dddd488e 100644 --- a/module/web/templates/default/collector.html +++ b/module/web/templates/default/collector.html @@ -38,8 +38,8 @@ document.addEvent("domready", function(){ {% block pageactions %}
<ul id="page-actions-more">
- <li id="del-finished"><a style="padding: 0; font-weight: bold;" href="#">{% trans "Delete Finished" %}</a></li>
- <li id="restart-failed"><a style="padding: 0; font-weight: bold;" href="#">{% trans "Restart Failed" %}</a></li>
+ <li id="del_finished"><a style="padding: 0; font-weight: bold;" href="#">{% trans "Delete Finished" %}</a></li>
+ <li id="restart_failed"><a style="padding: 0; font-weight: bold;" href="#">{% trans "Restart Failed" %}</a></li>
</ul>
{% endblock %}
|