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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
3 deletions
-
sql_request_abstract/models/sql_request_mixin.py
|
|
@ -5,7 +5,7 @@ |
|
|
|
|
|
|
|
import re |
|
|
|
import uuid |
|
|
|
from io import StringIO |
|
|
|
from io import BytesIO |
|
|
|
import base64 |
|
|
|
from psycopg2 import ProgrammingError |
|
|
|
|
|
|
@ -167,9 +167,8 @@ class SQLRequestMixin(models.AbstractModel): |
|
|
|
rollback_name = self._create_savepoint() |
|
|
|
try: |
|
|
|
if mode == 'stdout': |
|
|
|
output = StringIO.StringIO() |
|
|
|
output = BytesIO() |
|
|
|
self.env.cr.copy_expert(query, output) |
|
|
|
output.getvalue() |
|
|
|
res = base64.b64encode(output.getvalue()) |
|
|
|
output.close() |
|
|
|
else: |
|
|
|