generic.json 427 B

12345678910111213141516
  1. {{
  2. ###
  3. # response._vars contains the dictionary returned by the controller action
  4. ###
  5. try:
  6. from gluon.serializers import json
  7. response.write(json(response._vars), escape=False)
  8. response.headers['Content-Type'] = 'application/json; charset=utf-8'
  9. except (TypeError, ValueError):
  10. raise HTTP(405, 'JSON serialization error')
  11. except ImportError:
  12. raise HTTP(405, 'JSON not available')
  13. except:
  14. raise HTTP(405, 'JSON error')
  15. }}