diff options
author | Cédric Bonhomme <kimble.mandel+bitbucket@gmail.com> | 2015-07-21 17:50:34 +0200 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel+bitbucket@gmail.com> | 2015-07-21 17:50:34 +0200 |
commit | d5200b2c9879938fe8e66c0016023d62a9b4f291 (patch) | |
tree | bd474e414f10c01c3779ee27a4dd3bc5f81e59be /pyaggr3g470r/views/feed.py | |
parent | Updated translations. (diff) | |
parent | improving article listing : default icon and title for article link (diff) | |
download | newspipe-d5200b2c9879938fe8e66c0016023d62a9b4f291.tar.gz newspipe-d5200b2c9879938fe8e66c0016023d62a9b4f291.tar.bz2 newspipe-d5200b2c9879938fe8e66c0016023d62a9b4f291.zip |
Merged in jaesivsm/pyaggr3g470r (pull request #19)
small post vacations fix
Diffstat (limited to 'pyaggr3g470r/views/feed.py')
-rw-r--r-- | pyaggr3g470r/views/feed.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/pyaggr3g470r/views/feed.py b/pyaggr3g470r/views/feed.py index 11f549e6..1a3ad938 100644 --- a/pyaggr3g470r/views/feed.py +++ b/pyaggr3g470r/views/feed.py @@ -105,13 +105,15 @@ def bookmarklet(): try: feed = construct_feed_from(url) - except requests.exceptions.ConnectionError as e: - flash(gettext("Impossible to connect to the address: {}.".format(url)), "danger") + except requests.exceptions.ConnectionError: + flash(gettext("Impossible to connect to the address: {}.".format(url)), + "danger") return redirect(url_for('home')) if not feed.get('link'): feed['enabled'] = False flash(gettext("Couldn't find a feed url, you'll need to find a Atom or" - " RSS link manually and reactivate this feed"), 'warning') + " RSS link manually and reactivate this feed"), + 'warning') feed = feed_contr.create(**feed) flash(gettext('Feed was successfully created.'), 'success') if feed.enabled and conf.CRAWLING_METHOD == "classic": @@ -202,7 +204,12 @@ def icon(feed_id): icon = FeedController(None if g.user.is_admin() else g.user.id)\ .get(id=feed_id).icon etag = md5(icon.encode('utf8')).hexdigest() - headers = {'Cache-Control': 'max-age=86400', 'ETag': etag} + headers = {'Cache-Control': 'max-age=86400', 'etag': etag} if request.headers.get('if-none-match') == etag: return Response(status=304, headers=headers) - return Response(base64.b64decode(icon), mimetype='image', headers=headers) + if '\n' in icon: + content_type, icon = icon.split() + headers['content-type'] = content_type + else: + headers['content-type'] = 'application/image' + return Response(base64.b64decode(icon), headers=headers) |