Fix query history issue for Python 2.7, it is a regression of #4750.

This commit is contained in:
Akshay Joshi 2019-09-17 11:01:13 +05:30
parent 80b05973c6
commit b10378fe70

View File

@ -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
}
)