Commits

Benoît Allard committed 01f2072

web: Add a yaml route to get the rc of the final release

Comments (0)

Files changed (1)

 """
 from flask import Blueprint, request, abort, make_response, flash, get_flashed_messages
 from flask import url_for
+import sqlalchemy
 
 import models
 
         return yaml_response(last.rc + 1)
     return yaml_response(1)
 
+@yamlbp.route('/finalRc/<ref>')
+def finalRc(ref):
+    query = request.dbsession.query(models.Release) \
+                             .filter_by(ref=ref, final=True)
+    try:
+        release = query.one()
+    except sqlalchemy.orm.exc.NoResultFound:
+        release = None
+    if release is None:
+        abort(404)
+    return(yaml_response(release.rc))
 
 @yamlbp.errorhandler(404)
 def errorhandler(e):