Skip to content

Commit bee0af1

Browse files
committed
Improved django debug
1 parent 1443915 commit bee0af1

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

graphene/contrib/django/debug/schema.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ class DebugSchema(Schema):
4242

4343
@property
4444
def query(self):
45-
if not self._query:
46-
return
47-
return debug_objecttype(self._query)
45+
return self._query
4846

4947
@query.setter
5048
def query(self, value):
51-
self._query = value
49+
self._query = value and debug_objecttype(value)
5250

5351
def enable_instrumentation(self, wrapped_root):
5452
# This is thread-safe because database connections are thread-local.
@@ -59,10 +57,9 @@ def disable_instrumentation(self):
5957
for connection in connections.all():
6058
unwrap_cursor(connection)
6159

62-
def execute(self, *args, **kwargs):
63-
root = kwargs.pop('root', object())
60+
def execute(self, query, root=None, *args, **kwargs):
6461
wrapped_root = WrappedRoot(root=root)
6562
self.enable_instrumentation(wrapped_root)
66-
result = super(DebugSchema, self).execute(root=wrapped_root, *args, **kwargs)
63+
result = super(DebugSchema, self).execute(query, wrapped_root, *args, **kwargs)
6764
self.disable_instrumentation()
6865
return result

graphene/contrib/django/debug/sql/tracking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _record(self, method, sql, params):
100100
return method(sql, params)
101101
finally:
102102
stop_time = time()
103-
duration = (stop_time - start_time) * 1000
103+
duration = (stop_time - start_time)
104104
_params = ''
105105
try:
106106
_params = json.dumps(list(map(self._decode, params)))

0 commit comments

Comments
 (0)