-
-
Save efazati/4451510 to your computer and use it in GitHub Desktop.
flask title decorator, set title easy and simple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from functools import wraps | |
| def title(title=None): | |
| def decorator(f): | |
| @wraps(f) | |
| def decorated_function(*args, **kwargs): | |
| g.page_title = title | |
| return f(*args, **kwargs) | |
| return decorated_function | |
| return decorator |