[copr] master: Use the proper function for rendering the detail properly (a2b66fd)

bkabrda at fedorahosted.org bkabrda at fedorahosted.org
Fri Jan 11 11:08:46 UTC 2013


Repository : http://git.fedorahosted.org/cgit/copr.git

On branch  : master

>---------------------------------------------------------------

commit a2b66fdd82a59c7dbe2bd2e936513bf3389c017b
Author: Bohuslav Kabrda <bkabrda at redhat.com>
Date:   Fri Jan 11 11:52:31 2013 +0100

    Use the proper function for rendering the detail properly


>---------------------------------------------------------------

 .../coprs/views/coprs_ns/coprs_builds.py           |    5 +++--
 .../coprs/views/coprs_ns/coprs_general.py          |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py b/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
index 10268fb..7addf6e 100644
--- a/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
+++ b/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
@@ -13,6 +13,7 @@ from coprs.logic import coprs_logic
 
 from coprs.views.misc import login_required
 from coprs.views.coprs_ns import coprs_ns
+from coprs.views.coprs_ns import coprs_general
 
 @coprs_ns.route('/detail/<username>/<coprname>/builds/', defaults = {'page': 1})
 @coprs_ns.route('/detail/<username>/<coprname>/builds/<int:page>/')
@@ -53,8 +54,8 @@ def copr_add_build(username, coprname):
         flask.flash("Build was added")
         return flask.redirect(flask.url_for('coprs_ns.copr_detail', username = username, coprname = copr.name))
     else:
-        return flask.render_template('coprs/detail.html', copr = copr, form = form)
-
+        # TODO: figure out a more elegant way to get the function
+        return coprs_general.copr_detail(username = username, coprname = coprname, build_form = form)
 
 @coprs_ns.route('/detail/<username>/<coprname>/cancel_build/<int:build_id>/', methods = ['POST'])
 @login_required
diff --git a/coprs_frontend/coprs/views/coprs_ns/coprs_general.py b/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
index 1293763..2cd455c 100644
--- a/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
+++ b/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
@@ -85,8 +85,9 @@ def copr_new():
 
 
 @coprs_ns.route('/detail/<username>/<coprname>/')
-def copr_detail(username, coprname):
-    build_form = forms.BuildForm()
+def copr_detail(username, coprname, build_form = None):
+    if not build_form:
+        build_form = forms.BuildForm()
     try: # query[0:10][0] will raise an index error, if Copr doesn't exist
         query = coprs_logic.CoprsLogic.get(flask.g.user, username, coprname, with_builds = True)
         copr = query[0:10][0]# we retrieved all builds, but we got one copr in a list...



More information about the copr-devel mailing list