Mercurial > kraina_muminkow
view frontend/mfrontend/decorators.py @ 21:9a45dfaec157
To by było, miejmy nadzieję, na tyle w kwestii szablonu CSV
author | Michał Rudowicz <michal.rudowicz@fl9.eu> |
---|---|
date | Mon, 11 Apr 2011 09:50:23 +0200 |
parents | 58a993029d9f |
children |
line wrap: on
line source
#!/usr/bin/python # -*- coding: utf-8 -*- from functools import wraps from flask import g, request, redirect, url_for, session, flash def login_required(f): @wraps(f) def decorated_function(*args, **kwargs): try: if not session["logged_in"]: raise Exception() except Exception as e: flash(u"Nie masz uprawnień do oglądania żądanej strony.") return redirect(url_for('frontend.login')) return f(*args, **kwargs) return decorated_function