|
@ -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: |
|
|