Commits

Benoît Allard committed 634d493

web: Add support for querying releases without RC, getting the FINAL one

  • Participants
  • Parent commits 4a79f65

Comments (0)

Files changed (2)

File web/controller.py

     return res
 
 def getrelease(ref, rc):
-    release = request.dbsession.query(models.Release) \
-                               .filter_by(ref=ref, rc=rc) \
-                               .first()
+    query =  request.dbsession.query(models.Release) \
+                              .filter_by(ref = ref)
+    if rc == '':
+        query = query.filter_by(final = True)
+    else:
+        query = query.filter_by(rc =rc)
+    release = query.first()
     if release is None:
-        flash('Release %s-rc%s not found' % (ref, rc))
+        if rc == '':
+            flash("No release %s has been flagged as 'FINAL'" % ref)
+        else:
+            flash('Release %s-rc%s not found' % (ref, rc))
         abort(404)
     return release
 

File web/templates/diffreleases.html

 
 {% block body %}
 <h2>Difference between release <em>
-  {{- "%s-rc%s" % (request.args['oldref'], request.args['oldrc']) }}</em> and release <em>
-  {{- "%s-rc%s" % (request.args['newref'], request.args['newrc']) }}</em>.</h2>
+  {{- request.args['oldref'] }}{{ "-rc%s" % request.args['oldrc'] if  request.args['oldrc'] }}</em> and release <em>
+  {{- request.args['newref'] }}{{ "-rc%s" % request.args['newrc'] if  request.args['newrc'] }}</em>.</h2>
 <div>
   <h3>Global statistics:</h3>
   {% set plus, minus = issues %}