Ejemplo n.º 1
0
def render_json(data, filename=None, response=response):
    encoding = 'utf-8'  # RFC 4627.3
    response.content_type = 'application/json'
    response.content_encoding = encoding
    if filename is not None:
        response.content_disposition = 'attachment; filename="'\
            + filename.replace('"', '_') + '"'
    return json_dumps(data, encoding=encoding)
Ejemplo n.º 2
0
def render_json(data, filename=None, response=response):
    encoding = 'utf-8'  # RFC 4627.3
    response.content_type = 'application/json'
    response.content_encoding = encoding
    if filename is not None:
        response.content_disposition = 'attachment; filename="'\
            + filename.replace('"', '_') + '"'
    return json_dumps(data, encoding=encoding)
Ejemplo n.º 3
0
def render_json(data, encoding='utf-8'):
    response.content_type = 'text/javascript'
    response.content_encoding = encoding
    return json_dumps(data, encoding=encoding)
Ejemplo n.º 4
0
def render_json(data, encoding='utf-8'):
    response.content_type = 'text/javascript'
    response.content_encoding = encoding
    return json_dumps(data, encoding=encoding)