HOME/Articles/

mysql example lern checker (snippet)

Article Outline

Python mysql example 'lern checker'

Functions in program:

  • def check_logged_in(func):

python lern checker

Python mysql example: lern checker

from flask import session
from functools import wraps


def check_logged_in(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        if 'logged_in' in session:
            return func(*args, **kwargs)
        return 'You are now logged out'
    return wrapper