Commit d1a57d16 authored by Samuel Trégouët's avatar Samuel Trégouët
Browse files

[view] handle case when json field become a BufferedRandom instance

sometimes webob (or cgi) decide that json field content should be
BufferedRandom and not BytesIO in this case we cannot use getvalue
method
parent 342865dcac09
......@@ -114,7 +114,10 @@ class RqlIOController(Controller):
encoding = 'utf-8'
content = self._cw.form['json'][1]
try:
args = json.loads(content.getvalue().decode(encoding))
# here we use .read instead of .gevalue because
# on some circumstances content is an instance of BufferedRandom
# which has no getvalue method
args = json.loads(content.read().decode(encoding))
except ValueError as exc:
raise RemoteCallFailed(exc_message(exc, self._cw.encoding))
if not isinstance(args, (list, tuple)):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment