web/views/json.py
changeset 10397 1ce4594f9cf4
parent 10390 0bbd211cf4d7
child 10666 7f6b5f023884
--- a/web/views/json.py	Wed Apr 15 22:48:20 2015 +0200
+++ b/web/views/json.py	Thu Jun 18 18:22:55 2015 +0200
@@ -60,11 +60,11 @@
     def _get_json_data(self, rset):
         json_data = super(JsonpController, self).publish(rset)
         if 'callback' in self._cw.form: # jsonp
-            json_padding = self._cw.form['callback']
-            # use ``application/javascript`` is ``callback`` parameter is
-            # provided, let ``application/json`` otherwise
+            json_padding = self._cw.form['callback'].encode('ascii')
+            # use ``application/javascript`` if ``callback`` parameter is
+            # provided, keep ``application/json`` otherwise
             self._cw.set_content_type('application/javascript')
-            json_data = '%s(%s)' % (json_padding, json_data)
+            json_data = b'%s(%s)' % (json_padding, json_data)
         return json_data