generic.jsonp raises HTTP(404)

This commit is contained in:
mdipierro committed 2013-11-24 09:44:08 -06:00
1 parent 84cc47920b
commit ff2f11a706
2 files changed
+8 -1

No files matched your search

+7
View File
@@ -2,6 +2,13 @@
###
# response._vars contains the dictionary returned by the controller action
###
# security check! This file is an example for a jsonp view.
# it is not safe to use as a generic.jsonp because of security implications.
if response.view == 'generic.jsonp':
raise HTTP(501,'generic.jsonp diasbled for security reasons')
try:
from gluon.serializers import json
result = "%s(%s)" % (request.vars['callback'], json(response._vars))