flask title decorator, set title easy and simple

1 min read Original article ↗

@efazati

  • Select an option

  • Save efazati/4451510 to your computer and use it in GitHub Desktop.

Select an option

Save efazati/4451510 to your computer and use it in GitHub Desktop.

flask title decorator, set title easy and simple

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