Revision 22493a7198c34767abdabadf5133af93ab6152d1 authored by Jim Allman on 24 April 2015, 07:50:36 UTC, committed by Jim Allman on 24 April 2015, 07:50:36 UTC
1 parent 85944f5
Raw File
generic.json
{{
try:
    from gluon.serializers import json

    # web2py view expects a dict, but we might have a single JSON response ready
    full_response = response._vars.get('FULL_RESPONSE', None)
    if full_response:
        # handle a large file passed as list-of-lines (or iterator?)
        if type(full_response) == list:
            for line in full_response:
                response.write(line,escape=False)
	    pass
        else:
            response.write(full_response,escape=False)
	pass
    else:
        response.write(json(response._vars),escape=False)
    pass

    response.headers['Content-Type']='application/json'
except:
    raise HTTP(405,'no json')
pass
}}
back to top