mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-24 15:26:46 -06:00
Fix query history issue for Python 2.7, it is a regression of #4750.
This commit is contained in:
parent
80b05973c6
commit
b10378fe70
@ -1,6 +1,7 @@
|
||||
from pgadmin.utils.ajax import make_json_response
|
||||
from pgadmin.model import db, QueryHistoryModel
|
||||
from config import MAX_QUERY_HIST_STORED
|
||||
from pgadmin.utils import IS_PY2
|
||||
|
||||
|
||||
class QueryHistory:
|
||||
@ -15,14 +16,14 @@ class QueryHistory:
|
||||
.all()
|
||||
|
||||
# In Python 2.7, rec.query_info has buffer data type. Cast it.
|
||||
if IS_PY2:
|
||||
result = [bytes(rec.query_info) for rec in list(result)]
|
||||
|
||||
return make_json_response(
|
||||
data={
|
||||
'status': True,
|
||||
'msg': '',
|
||||
'result': [
|
||||
bytes(rec.query_info, encoding='utf8')
|
||||
for rec in list(result)
|
||||
]
|
||||
'result': result
|
||||
}
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user