decodeHTML works without connection object
parent
e759cd46c6
commit
3fd34ff1a6
6
morss.py
6
morss.py
|
@ -207,7 +207,7 @@ class HTMLDownloader(urllib2.HTTPCookieProcessor):
|
||||||
return self.parent.open(new, timeout=req.timeout)
|
return self.parent.open(new, timeout=req.timeout)
|
||||||
|
|
||||||
# decode
|
# decode
|
||||||
data = decodeHTML(resp, data)
|
data = decodeHTML(data, resp)
|
||||||
|
|
||||||
fp = StringIO(data)
|
fp = StringIO(data)
|
||||||
old_resp = resp
|
old_resp = resp
|
||||||
|
@ -250,8 +250,8 @@ class CacheDownload(urllib2.BaseHandler):
|
||||||
|
|
||||||
https_request = http_request
|
https_request = http_request
|
||||||
|
|
||||||
def decodeHTML(con, data):
|
def decodeHTML(data, con=None):
|
||||||
if con.headers.getparam('charset'):
|
if con is not None and con.headers.getparam('charset'):
|
||||||
log('header')
|
log('header')
|
||||||
enc = con.headers.getparam('charset')
|
enc = con.headers.getparam('charset')
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue