From 973d714fe92bafe7e770f02eebdeb9191f1665c9 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 19 Jan 2011 18:02:38 +0100 Subject: [PATCH] fireinfo: Add nicer error page if profile was not found or was disabled. --- www/templates/stasy-profile-notfound.html | 38 +++++++++++++++++++++++ www/translations/de_DE.csv | 1 + www/webapp/handlers_stasy.py | 12 +++++-- 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 www/templates/stasy-profile-notfound.html diff --git a/www/templates/stasy-profile-notfound.html b/www/templates/stasy-profile-notfound.html new file mode 100644 index 00000000..07ee767e --- /dev/null +++ b/www/templates/stasy-profile-notfound.html @@ -0,0 +1,38 @@ +{% extends "base-1.html" %} + +{% block title %}{{ _("Profile not found") }}}{% end block %} + +{% block content %} +

404 - {{ _("Profile not found") }}

+ {{ _( +

+ {% if lang == "de" %} + Es wurden keine Daten für das Profil {{ profile_id }} + gefunden. + {% else %} + There was no profile data found for profile + {{ profile_id }}. + {% end %} +

+

+ {% if lang == "de" %} + Der Eigentümer dieses Profils hat möglicherweise der Veröffentlichung + der Daten nicht zugestimmt oder diese abgeschaltet. + {% else %} + Apparently, the profile owner has not submitted any data or disabled + it recently. + {% end %} +

+

+ {% if lang == "de" %} + Falls dieses Profile Ihr eigenes ist, so können Sie die Veröffentlichung + im Web-Interface + einschalten. + {% else %} + If this is your own profile, you can + enable + the submission on the web user interface. + {% end %} +

+{% end block %} diff --git a/www/translations/de_DE.csv b/www/translations/de_DE.csv index 6741200f..cbaa0d34 100644 --- a/www/translations/de_DE.csv +++ b/www/translations/de_DE.csv @@ -259,3 +259,4 @@ "Mirror servers nearby","Mirror-Server in der Nähe" "Worldwide mirror servers","Weltweite Mirror-Server" "Preferred for","Bevorzugt für" +"Profile not found","Profil nicht gefunden" diff --git a/www/webapp/handlers_stasy.py b/www/webapp/handlers_stasy.py index c67497a2..e069812e 100644 --- a/www/webapp/handlers_stasy.py +++ b/www/webapp/handlers_stasy.py @@ -40,6 +40,10 @@ class StasyBaseHandler(BaseHandler): class StasyIndexHandler(StasyBaseHandler): + def _profile_not_found(self, profile_id): + self.set_status(404) + self.render("stasy-profile-notfound.html", profile_id=profile_id) + def get(self): self.render("stasy-index.html") @@ -49,16 +53,18 @@ class StasyIndexHandler(StasyBaseHandler): raise tornado.web.HTTPError(400, "No profile ID was given.") if not self.stasy.profile_exists(profile_id): - raise tornado.web.HTTPError(404, "Profile does not exist.") + self._profile_not_found(profile_id) + return self.redirect("/profile/%s" % profile_id) -class StasyProfileDetailHandler(StasyBaseHandler): +class StasyProfileDetailHandler(StasyIndexHandler): def get(self, profile_id): profile = self.stasy.get_profile(profile_id) if not profile: - raise tornado.web.HTTPError(404, "Profile not found: %s" % profile_id) + self._profile_not_found(profile_id) + return self.render("stasy-profile-detail.html", profile=profile) -- 2.47.3