[py3] ensure AjaxController return bytes 3.26
authorPhilippe Pepiot <philippe.pepiot@logilab.fr>
Fri, 15 Jun 2018 17:45:26 +0200
branch3.26
changeset 12324 39208d9256a2
parent 12323 562b09ec963a
child 12325 e1c1af68db86
[py3] ensure AjaxController return bytes publish() must return bytes, when the @ajaxfunc decorated method return None, this raised: TypeError: You cannot set Response.body to a text object (use Response.text)
cubicweb/web/views/ajaxcontroller.py
--- a/cubicweb/web/views/ajaxcontroller.py	Wed Jun 13 11:09:17 2018 +0200
+++ b/cubicweb/web/views/ajaxcontroller.py	Fri Jun 15 17:45:26 2018 +0200
@@ -163,7 +163,7 @@
                     fname, args, exc)
             raise RemoteCallFailed(exc_message(exc, self._cw.encoding))
         if result is None:
-            return ''
+            return b''
         # get unicode on @htmlize methods, encoded string on @jsonize methods
         elif isinstance(result, text_type):
             return result.encode(self._cw.encoding)