Flask does not include a login decorator function, but the documentation does provide an example of how to roll your own (http://flask.pocoo.org/docs/0.12/patterns/viewdecorators/). This should not be used for production use, even if it copies the Flask functionality, as you would then be responsible for ensuring that any modifications to your code don't affect the login functionality:
- Import the wraps function from the Python standard library's functools module. This is necessary to retain the original function's data:
from functools import wraps
- A number of Flask tools need to be imported. g is a Flask application global, a special object that is only valid for the active request and returns a different value for each ...