Peeking at file "demo_app3/views/generic.jsonp"

<<back Edit

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