diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-07-10 17:17:55 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-07-10 17:17:55 +0200 |
commit | 205a67b858f02b18ba1c8104cc0951df514a2981 (patch) | |
tree | 47be1c4079e6f98f3196688f49d48ebfaf797934 /pyaggr3g470r/views | |
parent | Improved the mini-form to create new feeds. (diff) | |
download | newspipe-205a67b858f02b18ba1c8104cc0951df514a2981.tar.gz newspipe-205a67b858f02b18ba1c8104cc0951df514a2981.tar.bz2 newspipe-205a67b858f02b18ba1c8104cc0951df514a2981.zip |
Management of connection errors when adding a new feed.
Diffstat (limited to 'pyaggr3g470r/views')
-rw-r--r-- | pyaggr3g470r/views/feed.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pyaggr3g470r/views/feed.py b/pyaggr3g470r/views/feed.py index e9827668..f5b48a17 100644 --- a/pyaggr3g470r/views/feed.py +++ b/pyaggr3g470r/views/feed.py @@ -1,6 +1,7 @@ #! /usr/bin/env python # -*- coding: utf-8 - import base64 +import requests.exceptions from hashlib import md5 from datetime import datetime from sqlalchemy import desc @@ -102,7 +103,11 @@ def bookmarklet(): "warning") return redirect(url_for('feed.form', feed_id=feed_exists[0].id)) - feed = construct_feed_from(url) + try: + feed = construct_feed_from(url) + except requests.exceptions.ConnectionError as e: + 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" |