[Pkg-debile-commits] [debile-web] 04/10: Fix some merge issues

Sylvestre Ledru sylvestre at alioth.debian.org
Tue Aug 27 13:22:34 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 30e7c3ec0c1f225bedae1b65bb450e56c878911e
Author: Sylvestre Ledru <sylvestre at debian.org>
Date:   Sat Aug 17 12:06:41 2013 +0200

    Fix some merge issues
---
 debile/blueprints/frontend.py |   41 +++++++++++++++++++++++++++++++++--------
 1 file changed, 33 insertions(+), 8 deletions(-)

diff --git a/debile/blueprints/frontend.py b/debile/blueprints/frontend.py
index c90957d..850eb6f 100644
--- a/debile/blueprints/frontend.py
+++ b/debile/blueprints/frontend.py
@@ -19,8 +19,11 @@
 # DEALINGS IN THE SOFTWARE.
 
 from flask import Blueprint, render_template, send_file
+
 from sqlalchemy.orm import joinedload
+
 from lucy.orm import Package, Source, Binary, Machine, User, Job, Group
+from lucy.archive import UserRepository
 from lucy.config import Config
 from lucy.server import Session
 
@@ -30,7 +33,7 @@ from humanize.time import naturaldelta
 from datetime import timedelta
 import datetime as dt
 import os.path
-
+from forms import SearchPackageForm
 
 frontend = Blueprint('frontend', __name__, template_folder='templates')
 
@@ -75,19 +78,32 @@ def get_machine_link(m):
 @frontend.route("/")
 def index():
     session = Session()
-    active_jobs = session.query(Job).options(joinedload('machine')).filter(Job.machine != None).filter(Job.finished_at == None).all()
+    active_jobs = session.query(Job)\
+        .options(joinedload('machine'))\
+        .filter(Job.machine != None)\
+        .filter(Job.finished_at == None)\
+        .all()
     machines = session.query(Machine).options(joinedload('jobs')).all()
     active_jobs_info = []
     for j in active_jobs:
         info = {}
         info['job'] = j
         info['package_link'] = get_package_link(j.package)
-        info['machine_link'] = get_machine_link(j.machine)
+        if j.machine:
+            info['machine_link'] = get_machine_link(j.machine)
         active_jobs_info.append(info)
-    return render_template('about.html', **{
+
+    pending_jobs = session.query(Job)\
+        .filter(Job.assigned_at == None)\
+        .count()
+
+    form = SearchPackageForm()
+
+    return render_template('index.html', **{
         "active_jobs_info": active_jobs_info,
-        "machines": machines,
-    })
+        "pending_jobs": pending_jobs,
+        "form": form
+        })
 
 
 @frontend.route("/sources/")
@@ -286,10 +302,19 @@ def machine(machine_name):
 @frontend.route("/hacker/<hacker_login>")
 def hacker(hacker_login):
     session = Session()
-	# FIXME : unsafe code, catch exceptions
+    # FIXME : unsafe code, catch exceptions
     user = session.query(User).filter(User.login == hacker_login).one()
+
+    ur = UserRepository(user)
+    dput_upload_profile = ur.generate_dputprofile()
+    apt_binary_list = ur.generate_aptbinarylist()
+    apt_source_list = ur.generate_aptsourcelist()
+
     return render_template('hacker.html', **{
-        "hacker": user
+        "hacker": user,
+        "dput_upload_profile": dput_upload_profile,
+        "apt_binary_list": apt_binary_list,
+        "apt_source_list": apt_source_list
     })
 
 

-- 
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