From 3fd34ff1a6ca34e65cd57cb343b6c2d155c77c2c Mon Sep 17 00:00:00 2001 From: pictuga Date: Wed, 25 Sep 2013 11:08:58 +0200 Subject: [PATCH] decodeHTML works without connection object --- morss.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/morss.py b/morss.py index 66a983d..c4edbc7 100644 --- a/morss.py +++ b/morss.py @@ -207,7 +207,7 @@ class HTMLDownloader(urllib2.HTTPCookieProcessor): return self.parent.open(new, timeout=req.timeout) # decode - data = decodeHTML(resp, data) + data = decodeHTML(data, resp) fp = StringIO(data) old_resp = resp @@ -250,8 +250,8 @@ class CacheDownload(urllib2.BaseHandler): https_request = http_request -def decodeHTML(con, data): - if con.headers.getparam('charset'): +def decodeHTML(data, con=None): + if con is not None and con.headers.getparam('charset'): log('header') enc = con.headers.getparam('charset') else: