From a85cdf1ec92bc995daaff3657b3b4abaace6f180 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sat, 29 Dec 2012 22:45:45 +0100 Subject: Improved error response. --- source/pyAggr3g470r.py | 12 ++++++------ source/templates/unread.html | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 7dafc52e..7a6e450e 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -62,16 +62,17 @@ def error_404(status, message, traceback, version): """ Display an error if the page does not exist. """ - html = "

Error %s - This page does not exist." % status - return html + message = "" % status + tmpl = lookup.get_template("error.html") + return tmpl.render(message=message) def handle_error(): """ Handle different type of errors. """ - html = "

Sorry, an error occured" + message = "

Sorry, an error occured.

" cherrypy.response.status = 500 - cherrypy.response.body = [html] + cherrypy.response.body = [message] class RestrictedArea(object): """ @@ -332,8 +333,7 @@ class pyAggr3g470r(object): description = "Unvailable" tmpl = lookup.get_template("plain_text.html") return tmpl.render(feed_title=feed["feed_title"], \ - article_title=article["article_title"], \ - description = description) + article_title=article["article_title"], description = description) plain_text.exposed = True diff --git a/source/templates/unread.html b/source/templates/unread.html index 32201531..d37d3034 100644 --- a/source/templates/unread.html +++ b/source/templates/unread.html @@ -42,12 +42,13 @@ import utils (feed["feed_id"],) html += """
\nMark articles as read\n""" + # List unread articles of a feed else: try: feed = mongo.get_feed(feed_id) except: - error("This feed do not exists.") + return "

This feed do not exists.

" html += """

Unread article(s) of the feed %s


""" % (feed_id, feed["feed_title"]) -- cgit