decorators.py 251 Bytes
Newer Older
Marco Mariani's avatar
Marco Mariani committed
1 2
# -*- coding: utf-8 -*-
# vim: set et sts=2:
Marco Mariani's avatar
Marco Mariani committed
3
#pylint: disable-all
Marco Mariani's avatar
Marco Mariani committed
4 5 6 7 8 9 10 11 12 13

import json

from flask import Response


def as_json(f):
  def inner(*args, **kwargs):
    return Response(json.dumps(f(*args, **kwargs)), mimetype='application/json')
  return inner