Mercurial > kraina_muminkow
view frontend/mfrontend/views/jobcontrol.py @ 16:c87f82a15606
Dopisałem co nieco do dokumentacji i małę poprawki w zarządzainu zadaniami
author | Michał Rudowicz <michal.rudowicz@fl9.eu> |
---|---|
date | Sun, 03 Apr 2011 13:47:13 +0200 |
parents | 79cf8ca2a0e5 |
children | 28eb82047167 |
line wrap: on
line source
#!/usr/bin/python # -*- coding: utf-8 -*- from flask import Module, render_template, request, url_for from flask import escape, session, redirect, flash, abort, g from mfrontend import db, utils, exceptions, decorators jobcontrol = Module(__name__) @jobcontrol.route('/') @decorators.login_required def index(): jobs = db.get_jobs(None, None, None) return render_template('joblist.html', jobs=jobs) @jobcontrol.route('/add/', methods=['GET', 'POST']) @decorators.login_required def add(): if request.method == 'POST': try: db.new_job(session['user_id'], request.form["label"], request.form["hash"], request.form["method"]) return redirect(url_for('index')) except Exception as e: flash(e) return render_template('newjob.html')