aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-01-05 11:14:35 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-01-05 11:14:35 +0100
commit2c2fb340ad1d62c02cc9a1aadb3921ad31303c6a (patch)
tree7de73ad036750caf97a532a6faa98cbf229eb299 /source
parentNumbers are printed with commas as thousands separators (/feed page). (diff)
downloadnewspipe-2c2fb340ad1d62c02cc9a1aadb3921ad31303c6a.tar.gz
newspipe-2c2fb340ad1d62c02cc9a1aadb3921ad31303c6a.tar.bz2
newspipe-2c2fb340ad1d62c02cc9a1aadb3921ad31303c6a.zip
Improved display of error message.
Diffstat (limited to 'source')
-rwxr-xr-xsource/pyAggr3g470r.py22
-rw-r--r--source/templates/error.html3
2 files changed, 14 insertions, 11 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py
index 6bb795f0..002eaf36 100755
--- a/source/pyAggr3g470r.py
+++ b/source/pyAggr3g470r.py
@@ -86,7 +86,9 @@ class RestrictedArea(object):
@cherrypy.expose
def index(self):
- return """This is the admin only area."""
+ message = "<p>This is the admin only area.</p>"
+ tmpl = lookup.get_template("error.html")
+ return tmpl.render(message=message)
class pyAggr3g470r(object):
"""
@@ -193,7 +195,7 @@ class pyAggr3g470r(object):
articles = self.mongo.get_articles(feed_id)
article = self.mongo.get_articles(feed_id, article_id)
except:
- return self.error("Bad URL. This article do not exists.")
+ return self.error("<p>Bad URL. This article do not exists.</p>")
if article["article_readed"] == False:
# if the current article is not yet readed, update the database
@@ -262,7 +264,7 @@ class pyAggr3g470r(object):
nb_unread_articles_feed = self.mongo.nb_unread_articles(feed_id)
favorites = self.mongo.get_favorites(feed_id)
except KeyError:
- return self.error("This feed do not exists.")
+ return self.error("<p>This feed do not exists.</p>")
if articles != []:
today = datetime.datetime.now()
@@ -293,7 +295,7 @@ class pyAggr3g470r(object):
feed = self.mongo.get_feed(feed_id)
articles = self.mongo.get_articles(feed_id)
except KeyError:
- return self.error("This feed do not exists.")
+ return self.error("<p>This feed do not exists.</p>")
tmpl = lookup.get_template("articles.html")
return tmpl.render(articles=articles, feed=feed)
@@ -330,7 +332,7 @@ class pyAggr3g470r(object):
feed = self.mongo.get_feed(feed_id)
article = self.mongo.get_articles(feed_id, article_id)
except:
- return self.error("Bad URL. This article do not exists.")
+ return self.error("<p>Bad URL. This article do not exists.</p>")
description = utils.clear_string(article["article_content"])
if not description:
description = "Unvailable"
@@ -390,7 +392,7 @@ class pyAggr3g470r(object):
try:
action, feed_id = param.split(':')
except:
- return self.error("Bad URL. This feed do not exists.")
+ return self.error("<p>Bad URL. This feed do not exists.</p>")
return self.index()
mail_notification.exposed = True
@@ -404,7 +406,7 @@ class pyAggr3g470r(object):
like, feed_id, article_id = param.split(':')
articles = self.mongo.get_articles(feed_id, article_id)
except:
- return self.error("Bad URL. This article do not exists.")
+ return self.error("<p>Bad URL. This article do not exists.</p>")
self.mongo.like_article("1"==like, feed_id, article_id)
return self.article(feed_id+":"+article_id)
@@ -452,7 +454,7 @@ class pyAggr3g470r(object):
# search the feed in the HTML page with BeautifulSoup
feed_url = utils.search_feed(url)
if feed_url is None:
- return self.error("Impossible to find a feed at this URL.")
+ return self.error("<p>Impossible to find a feed at this URL.</p>")
# if a feed exists
else:
result = utils.add_feed(feed_url)
@@ -523,7 +525,7 @@ class pyAggr3g470r(object):
feed_id, article_id = param.split(':')
self.mongo.delete_article(feed_id, article_id)
except:
- return self.error("Bad URL. This article do not exists.")
+ return self.error("<p>Bad URL. This article do not exists.</p>")
return self.index()
@@ -574,7 +576,7 @@ class pyAggr3g470r(object):
articles = self.mongo.get_articles(feed_id)
article = self.mongo.get_articles(feed_id, article_id)
except:
- self.error("This article do not exists.")
+ self.error("<p>This article do not exists.</p>")
try:
folder = conf.path + "/var/export/epub/"
os.makedirs(folder)
diff --git a/source/templates/error.html b/source/templates/error.html
index dbdf66db..3790d3e9 100644
--- a/source/templates/error.html
+++ b/source/templates/error.html
@@ -1,4 +1,5 @@
## error.html
<%inherit file="base.html"/>
<div class="left inner">
-${message} \ No newline at end of file
+ <h1>An error occured:</h1>
+ ${message} \ No newline at end of file
bgstack15