Mercurial > hg > ltpdarepo
changeset 187:e06b0e162757
Remove unused source file.
author | Daniele Nicolodi <daniele@grinta.net> |
---|---|
date | Tue, 08 Nov 2011 15:10:33 +0100 |
parents | 8da56d2a70d6 |
children | fbab144c296c |
files | src/ltpdarepo/views/base.py |
diffstat | 1 files changed, 0 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ltpdarepo/views/base.py Tue Nov 08 12:46:54 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -from flask import Blueprint, request, session, redirect, flash, render_template, g - -from ltpdarepo.security import require, authenticate - -app = Blueprint('base', __name__) - - -@app.route('/login', methods=('GET', 'POST')) -def login(): - if request.method == 'POST': - if authenticate(request.form['username'], request.form['password']): - session['username'] = request.form['username'] - url = request.args.get('next', '/') - return redirect(url) - flash('Login failed.', category='error') - - return render_template('login.html') - - -@app.route('/logout') -def logout(): - session.pop('username', None) - return redirect('/') - - -@app.route('/') -@require('user') -def index(): - curs = g.db.cursor() - curs.execute("""SELECT DISTINCT Db FROM mysql.db, available_dbs - WHERE Select_priv='Y' AND User=%s AND Db=db_name - ORDER BY Db""", session['username']) - dbs = [row[0] for row in curs.fetchall()] - return render_template('index.html', databases=dbs) - -module = app