[Pkg-debile-commits] [debile-web] 05/07: when the version cannot be found, display a nice error message + provide a link to the latest release

Sylvestre Ledru sylvestre at alioth.debian.org
Sat Sep 28 13:31:17 UTC 2013


This is an automated email from the git hooks/post-receive script.

sylvestre pushed a commit to branch update-usuability
in repository debile-web.

commit b938688e385250f815a1dd882816ce6aca3b930a
Author: Sylvestre Ledru <sylvestre at debian.org>
Date:   Sat Sep 28 14:15:05 2013 +0200

    when the version cannot be found, display a nice error message + provide a link to the latest release
---
 debileweb/blueprints/frontend.py |    7 +++++++
 templates/source-not-found.html  |    5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/debileweb/blueprints/frontend.py b/debileweb/blueprints/frontend.py
index f20a712..0b8883e 100644
--- a/debileweb/blueprints/frontend.py
+++ b/debileweb/blueprints/frontend.py
@@ -187,6 +187,13 @@ def source(package_name="", owner_name="fred", package_version="latest", run_num
         .order_by(Source.run.asc())
     runs = [e[0] for e in runs_query.all()]
 
+    if len(runs) == 0:
+        return render_template('source-not-found.html', **{
+                "package_name": package_name,
+                "version": this_version
+                })
+
+    
     latest_run = runs[-1]
     if run_number == '0':
         this_run = latest_run
diff --git a/templates/source-not-found.html b/templates/source-not-found.html
index 061439f..4e83188 100644
--- a/templates/source-not-found.html
+++ b/templates/source-not-found.html
@@ -4,6 +4,9 @@
 
 {% block content %}
 
-Package <i>{{ package_name }}</i> not found
+Package <i>{{ package_name }}</i> {% if version %} {{ version }} {% endif %} not found
+{% if version %}<br />
+Try the <a href="/source/fred/{{ package_name }}/latest/1">latest release</a>
+{% endif %}
 
 {% endblock %}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-web.git



More information about the Pkg-debile-commits mailing list