##// END OF EJS Templates
cached-commits: updated logic on cached commit updates....
cached-commits: updated logic on cached commit updates. - for repositories we ensure that damaged/empty repositories have initial data instead of now (bug) - for groups we only update based on first set of data inside a group without iterating to nested objects. This new logic goes in sync with new update task of groups with automation.

File last commit:

r3912:9bf26830 default
r4162:5cadc4f9 default
Show More
flask.py
47 lines | 1.3 KiB | text/x-python | PythonLexer
# -*- coding: utf-8 -*-
"""
|flask| Extras
--------------
Utilities you can use when using this library with the |flask|_ framework.
Thanks to `Mark Steve Samson <http://marksteve.com>`_.
"""
from __future__ import absolute_import
from functools import wraps
from authomatic.adapters import WerkzeugAdapter
from authomatic import Authomatic
from flask import make_response, request, session
class FlaskAuthomatic(Authomatic):
"""
Flask Plugin for authomatic support.
"""
result = None
def login(self, *login_args, **login_kwargs):
"""
Decorator for Flask view functions.
"""
def decorator(f):
@wraps(f)
def decorated(*args, **kwargs):
self.response = make_response()
adapter = WerkzeugAdapter(request, self.response)
login_kwargs.setdefault('session', session)
login_kwargs.setdefault('session_saver', self.session_saver)
self.result = super(FlaskAuthomatic, self).login(
adapter,
*login_args,
**login_kwargs)
return f(*args, **kwargs)
return decorated
return decorator
def session_saver(self):
session.modified = True