aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2012-12-29 22:45:45 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2012-12-29 22:45:45 +0100
commita85cdf1ec92bc995daaff3657b3b4abaace6f180 (patch)
tree4cc5eaea01d5a15fe27ac1e6194527fa23ec0904 /source
parentadd_feed now uses templated. (diff)
downloadnewspipe-a85cdf1ec92bc995daaff3657b3b4abaace6f180.tar.gz
newspipe-a85cdf1ec92bc995daaff3657b3b4abaace6f180.tar.bz2
newspipe-a85cdf1ec92bc995daaff3657b3b4abaace6f180.zip
Improved error response.
Diffstat (limited to 'source')
-rwxr-xr-xsource/pyAggr3g470r.py12
-rw-r--r--source/templates/unread.html3
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 = "<br /><br />Error %s - This page does not exist." % status
- return html
+ message = "<pError %s - This page does not exist.</p>" % status
+ tmpl = lookup.get_template("error.html")
+ return tmpl.render(message=message)
def handle_error():
"""
Handle different type of errors.
"""
- html = "<br /><br />Sorry, an error occured"
+ message = "<p>Sorry, an error occured.</p>"
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 += """<hr />\n<a href="/mark_as_read/">Mark articles as read</a>\n"""
+
# List unread articles of a feed
else:
try:
feed = mongo.get_feed(feed_id)
except:
- error("This feed do not exists.")
+ return "<p>This feed do not exists.</p>"
html += """<h1>Unread article(s) of the feed <a href="/articles/%s">%s</a></h1>
<br />""" % (feed_id, feed["feed_title"])
bgstack15