mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Patch for issue #609 for MinTimeLoggingConnection
On Python3 MinTimeLoggingConnection raises an exception as it tries to mix strings and bytes
This commit is contained in:
parent
dfee199351
commit
b804c092ac
|
@ -455,6 +455,8 @@ class MinTimeLoggingConnection(LoggingConnection):
|
||||||
def filter(self, msg, curs):
|
def filter(self, msg, curs):
|
||||||
t = (_time.time() - curs.timestamp) * 1000
|
t = (_time.time() - curs.timestamp) * 1000
|
||||||
if t > self._mintime:
|
if t > self._mintime:
|
||||||
|
if _sys.version_info[0] >= 3 and isinstance(msg, bytes):
|
||||||
|
msg = msg.decode(_ext.encodings[self.encoding], 'replace')
|
||||||
return msg + _os.linesep + " (execution time: %d ms)" % t
|
return msg + _os.linesep + " (execution time: %d ms)" % t
|
||||||
|
|
||||||
def cursor(self, *args, **kwargs):
|
def cursor(self, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user