def inject_variables(): ''' Inject some variables in every templates. ''' releases = dbtools.getcurrentreleases(SESSION) rawhide = dbtools.getrawhide(SESSION) admin = False if is_authenticated(): admin = is_admin(flask.g.fas_user) return dict( date=datetime.datetime.utcnow().strftime("%a %b %d %Y %H:%M"), releases=releases, rawhide=rawhide, version=__version__, is_admin=admin, )
def index(): ''' Display the index page. ''' releases = dbtools.getcurrentreleases(SESSION) rawhide = dbtools.getrawhide(SESSION) test_matrix = [] for release in releases: arches = dbtools.getarches(SESSION, release.releasenum) for arch in arches: results = dbtools.getlatest(SESSION, release.releasenum, arch[0]) if results: test_matrix.append(results) return flask.render_template( 'index.html', releases=releases, rawhide=rawhide, test_matrix=test_matrix, )