scout/server/utils.py
def templated(template=None):
    """Template decorator.

    Ref: http://flask.pocoo.org/docs/patterns/viewdecorators/
    """
    def decorator(f):
        @wraps(f)
        def decorated_function(*args, **kwargs):
            template_name = template
            if template_name is None:
                template_name = request.endpoint.replace('.', '/') + '.html'
            context = f(*args, **kwargs)
            if context is None:
                context = {}
            elif not isinstance(context, dict):
                return context
            return render_template(template_name, **context)
        return decorated_function
    return decorator
def templated(template=None):
    def decorator(f):
        @wraps(f)
        def decorated_function(*args, **kwargs):
            template_name = template
            if template_name is None:
                template_name = request.endpoint.replace('.', '/') + '.html'
            context = f(*args, **kwargs)
            if context is None:
                context = {}
            elif not isinstance(context, dict):
                return context
            return render_template(template_name, **context)
        return decorated_function
    return decorator
def templated ( template = None ) : def decorator ( f ) : @ wraps ( f ) def decorated_function ( * args , * * kwargs ) : template_name = template if template_name is None : template_name = request . endpoint . replace ( '.' , '/' ) + '.html' context = f ( * args , * * kwargs ) if context is None : context = { } elif not isinstance ( context , dict ) : return context return render_template ( template_name , * * context ) return decorated_function return decorator
Template decorator.

    Ref: http://flask.pocoo.org/docs/patterns/viewdecorators/
Template decorator .