Browse Source

Merge pull request #1555 from akretion/12-fix-sql-abstarct

FIX sql_request_abstract: b64encode use a Bytes like object
pull/1566/head
Pedro M. Baeza 6 years ago
committed by GitHub
parent
commit
268fa2c3e2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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