main
Last change
on this file was
42bd667,
checked in by David Fuertes <dfuertes@…>, 4 years ago
|
Historial Limpio
|
-
Property mode set to
100644
|
File size:
753 bytes
|
Line | |
---|
1 | {{ |
---|
2 | ### |
---|
3 | # response._vars contains the dictionary returned by the controller action |
---|
4 | ### |
---|
5 | |
---|
6 | # security check! This file is an example for a jsonp view. |
---|
7 | # it is not safe to use as a generic.jsonp because of security implications. |
---|
8 | |
---|
9 | if response.view == 'generic.jsonp': |
---|
10 | raise HTTP(501,'generic.jsonp disabled for security reasons') |
---|
11 | |
---|
12 | try: |
---|
13 | from gluon.serializers import json |
---|
14 | result = "%s(%s)" % (request.vars['callback'], json(response._vars)) |
---|
15 | response.write(result, escape=False) |
---|
16 | response.headers['Content-Type'] = 'application/jsonp' |
---|
17 | except (TypeError, ValueError): |
---|
18 | raise HTTP(405, 'JSON serialization error') |
---|
19 | except ImportError: |
---|
20 | raise HTTP(405, 'JSON not available') |
---|
21 | except: |
---|
22 | raise HTTP(405, 'JSON error') |
---|
23 | }} |
---|
Note: See
TracBrowser
for help on using the repository browser.