Merge branch 'master' of github.com:samuelclay/NewsBlur into social

* 'master' of github.com:samuelclay/NewsBlur:
  Fixing bug around missing feed value when skipping fetch (and not updating last_update date).
  Handling zlib/deflate issues, specifically for The Verge.
This commit is contained in:
Samuel Clay 2012-03-22 13:42:09 -07:00
commit 929366221e
2 changed files with 8 additions and 8 deletions

View file

@ -410,8 +410,9 @@ class Dispatcher:
for key, val in ret_entries.items():
self.entry_stats[key] += val
if len(feed_queue) == 1:
return feed
if len(feed_queue) == 1:
feed = self.refresh_feed(feed_queue[0])
return feed
# time_taken = datetime.datetime.utcnow() - self.time_start

View file

@ -9,7 +9,7 @@ Required: Python 2.4 or later
Recommended: iconv_codec <http://cjkpython.i18n.org/>
"""
__version__ = "5.1"
__version__ = "5.1.1"
__license__ = """
Copyright (c) 2010-2012 Kurt McKee <contactme@kurtmckee.org>
Copyright (c) 2002-2008 Mark Pilgrim
@ -3834,6 +3834,8 @@ def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, refer
elif zlib and 'deflate' in http_headers.get('content-encoding', ''):
try:
data = zlib.decompress(data)
except zlib.error, e:
data = zlib.decompress(data, -zlib.MAX_WBITS)
except zlib.error, e:
result['bozo'] = 1
result['bozo_exception'] = e
@ -3924,10 +3926,7 @@ def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, refer
break
# if no luck and we have auto-detection library, try that
if (not known_encoding) and chardet:
# import pdb; pdb.set_trace()
proposed_encoding = chardet.detect(data)['encoding']
if proposed_encoding:
proposed_encoding = unicode(proposed_encoding, 'ascii', 'ignore')
proposed_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
if proposed_encoding and (proposed_encoding not in tried_encodings):
tried_encodings.append(proposed_encoding)
try:
@ -4010,4 +4009,4 @@ def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, refer
result['entries'] = feedparser.entries
result['version'] = result['version'] or feedparser.version
result['namespaces'] = feedparser.namespacesInUse
return result
return result