From a22f876356e3f916b535e79bf98fba4dd0d9dbf7 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Wed, 13 Mar 2013 18:30:10 +0100 Subject: Error messages are displayed with a dedicated function. --- source/pyAggr3g470r.py | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'source/pyAggr3g470r.py') diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index d17d100b..b8e5edcd 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -521,12 +521,9 @@ class pyAggr3g470r(object): try: self.mongo.update_feed(feed_id, {"site_link":new_site_url}) tmpl = lookup.get_template("confirmation.html") - message = "

The URL of the site has been changed.

" + return tmpl.render(message="

The URL of the site has been changed.

") except: - tmpl = lookup.get_template("error.html") - message = "

Error when changing the URL of the site.

" - finally: - return tmpl.render(message=message) + return self.error("

Error when changing the URL of the site.

") change_site_url.exposed = True @@ -539,11 +536,9 @@ class pyAggr3g470r(object): result = utils.change_feed_url(old_feed_url, new_feed_url) if result: tmpl = lookup.get_template("confirmation.html") - message = "

The URL of the feed has been changed.

" + return tmpl.render("

The URL of the feed has been changed.

") else: - tmpl = lookup.get_template("error.html") - message = "

Error when changing the URL of the feed.

" - return tmpl.render(message=message) + return self.error("

Error when changing the URL of the feed.

") change_feed_url.exposed = True @@ -555,11 +550,9 @@ class pyAggr3g470r(object): try: self.mongo.update_feed(feed_id, {"feed_title":new_feed_name}) tmpl = lookup.get_template("confirmation.html") - message = "

The name of the feed has been changed.

" + return tmpl.render("

The name of the feed has been changed.

") except: - tmpl = lookup.get_template("error.html") - message = "

Error when changing the name of the feed.

" - return tmpl.render(message=message) + return self.error("

Error when changing the name of the feed.

") change_feed_name.exposed = True @@ -571,11 +564,9 @@ class pyAggr3g470r(object): try: self.mongo.update_feed(feed_id, {"feed_image":new_feed_logo}) tmpl = lookup.get_template("confirmation.html") - message = "

The logo of the feed has been changed.

" + return tmpl.render("

The logo of the feed has been changed.

") except: - tmpl = lookup.get_template("error.html") - message = "

Error when changing the logo of the feed.

" - return tmpl.render(message=message) + return self.error("

Error when changing the logo of the feed.

") change_feed_logo.exposed = True -- cgit