in src/asfquart/utils.py [0:0]
def use_template(template):
# The @use_template(T_MAIN) example is actually a function call
# to *produce* a decorator function. This is that decorator. It
# takes a function to wrap (FUNC), and produces a wrapping function
# that will be used during operation (WRAPPER).
def decorator(func):
# .wraps() copies name/etc from FUNC onto the wrapper function
# that we return.
@functools.wraps(func)
async def wrapper(*args, **kw):
# Get the data dictionary from the page endpoint.
data = await func(*args, **kw)
# Render that page, and return it to Quart.
return render(template, data)
return wrapper
return decorator