Commit 18c96931 authored by Julien Muchembled's avatar Julien Muchembled

DeadlockDebugger: don't print "MySQL query: no query" when there is no query

parent a3cd5781
...@@ -62,14 +62,14 @@ def dump_threads(): ...@@ -62,14 +62,14 @@ def dump_threads():
if reqinfo: if reqinfo:
reqinfo = " (%s)" % reqinfo reqinfo = " (%s)" % reqinfo
mysql_info = 'no query' mysql_info = ''
f = frame f = frame
try: try:
from Products.ZMySQLDA.db import DB from Products.ZMySQLDA.db import DB
while f is not None: while f is not None:
code = f.f_code code = f.f_code
if code is DB._query.func_code: if code is DB._query.func_code:
mysql_info = str(f.f_locals['query']) mysql_info = "MySQL query:\n%s\n" % f.f_locals['query']
break break
f = f.f_back f = f.f_back
except ImportError: except ImportError:
...@@ -77,7 +77,7 @@ def dump_threads(): ...@@ -77,7 +77,7 @@ def dump_threads():
output = StringIO() output = StringIO()
traceback.print_stack(frame, file=output) traceback.print_stack(frame, file=output)
res.append("Thread %s%s:\n%s\nMySQL query:\n%s\n" % res.append("Thread %s%s:\n%s\n%s" %
(thread_id, reqinfo, output.getvalue(), mysql_info)) (thread_id, reqinfo, output.getvalue(), mysql_info))
res.append("End of dump\n") res.append("End of dump\n")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment