Browse Source

FIX sql_request_abstract: b64encode use a Bytes like object

pull/1555/head
David Beal 6 years ago
parent
commit
3b0ac4cb98
  1. 5
      sql_request_abstract/models/sql_request_mixin.py

5
sql_request_abstract/models/sql_request_mixin.py

@ -5,7 +5,7 @@
import re import re
import uuid import uuid
from io import StringIO
from io import BytesIO
import base64 import base64
from psycopg2 import ProgrammingError from psycopg2 import ProgrammingError
@ -167,9 +167,8 @@ class SQLRequestMixin(models.AbstractModel):
rollback_name = self._create_savepoint() rollback_name = self._create_savepoint()
try: try:
if mode == 'stdout': if mode == 'stdout':
output = StringIO.StringIO()
output = BytesIO()
self.env.cr.copy_expert(query, output) self.env.cr.copy_expert(query, output)
output.getvalue()
res = base64.b64encode(output.getvalue()) res = base64.b64encode(output.getvalue())
output.close() output.close()
else: else:

Loading…
Cancel
Save