From a62149644fdac4a418c56f829482179817ae084a Mon Sep 17 00:00:00 2001 From: fragonib Date: Sun, 24 Apr 2011 17:49:54 +0200 Subject: UploadStation & BitshareCom: Unicode issues --- module/plugins/hoster/BitshareCom.py | 17 ++++++----------- module/plugins/hoster/UploadStationCom.py | 13 +++++-------- 2 files changed, 11 insertions(+), 19 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 496071fa3..555565df2 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -1,16 +1,12 @@ # -*- coding: utf-8 -*- from __future__ import with_statement -import re -import unicodedata - -from os import remove - +from module.network.RequestFactory import getURL from module.plugins.Hoster import Hoster from module.plugins.ReCaptcha import ReCaptcha -from module.network.RequestFactory import getURL -from wx.lib.analogclock.helpers import Hand +import re +import unicodedata def unicode2str(unitext): return unicodedata.normalize('NFKD', unitext).encode('ascii', 'ignore') @@ -138,16 +134,15 @@ class BitshareCom(Hoster): dl = self.download(url) def handleErrors(self, response, separator): - self.log.debug("%s: Checking response [%s]" % (self.__name__, response)) + self.log.debug("%s: Checking response [%s]" % (self.__name__, unicode2str(response))) if "ERROR" in response: msg = response.split(separator)[-1] self.fail(msg) def handleCaptchaErrors(self, response): - self.log.debug("%s: Result of captcha resolving [%s]" % (self.__name__, response)) + self.log.debug("%s: Result of captcha resolving [%s]" % (self.__name__, unicode2str(response))) if "SUCCESS" in response: return True self.log.debug("%s: Wrong captcha" % (self.__name__)) - self.invalidCaptcha() - + self.invalidCaptcha() \ No newline at end of file diff --git a/module/plugins/hoster/UploadStationCom.py b/module/plugins/hoster/UploadStationCom.py index 19c2d078d..4701bee26 100644 --- a/module/plugins/hoster/UploadStationCom.py +++ b/module/plugins/hoster/UploadStationCom.py @@ -1,15 +1,12 @@ # -*- coding: utf-8 -*- from __future__ import with_statement -import re -import unicodedata - -from os import remove - +from module.network.RequestFactory import getURL from module.plugins.Hoster import Hoster from module.plugins.ReCaptcha import ReCaptcha -from module.network.RequestFactory import getURL +import re +import unicodedata def unicode2str(unitext): return unicodedata.normalize('NFKD', unitext).encode('ascii', 'ignore') @@ -94,7 +91,7 @@ class UploadStationCom(Hoster): # Check download response = self.load(self.pyfile.url, post={"checkDownload" : "check"}) - self.log.debug("%s: Checking download, response [%s]" % (self.__name__, response)) + self.log.debug("%s: Checking download, response [%s]" % (self.__name__, unicode2str(response))) self.handleErrors(response) # We got a captcha? @@ -107,7 +104,7 @@ class UploadStationCom(Hoster): post={'recaptcha_challenge_field' : challenge, 'recaptcha_response_field' : code, 'recaptcha_shortencode_field' : self.fileId}) - self.log.debug("%s: Result of captcha resolving [%s]" % (self.__name__, response)) + self.log.debug("%s: Result of captcha resolving [%s]" % (self.__name__, unicode2str(response))) self.handleCaptchaErrors(response) # Process waiting -- cgit v1.2.3