Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Sep 26, 2023
2 parents 39f3b6f + 06c42d9 commit 498f434
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
hooks:
- id: doc8
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.14.1
rev: 1.15.0
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
Expand All @@ -24,27 +24,27 @@ repos:
- id: rst-backticks
- id: rst-directive-colons
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.2
rev: v3.0.3
hooks:
- id: prettier
types_or: [javascript, css]
args:
- --trailing-comma=es5
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.48.0
rev: v8.50.0
hooks:
- id: eslint
files: \.js?$
types: [file]
args:
- --fix
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.0.286'
rev: 'v0.0.291'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black
language_version: python3
Expand Down
19 changes: 1 addition & 18 deletions debug_toolbar/panels/sql/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,6 @@ class NormalCursorMixin(DjDTCursorWrapperMixin):
Wraps a cursor and logs queries.
"""

def _quote_expr(self, element):
if isinstance(element, str):
return "'%s'" % element.replace("'", "''")
else:
return repr(element)

def _quote_params(self, params):
if not params:
return params
if isinstance(params, dict):
return {key: self._quote_expr(value) for key, value in params.items()}
if isinstance(params, tuple):
return tuple(self._quote_expr(p) for p in params)
return [self._quote_expr(p) for p in params]

def _decode(self, param):
if PostgresJson and isinstance(param, PostgresJson):
# psycopg3
Expand Down Expand Up @@ -157,9 +142,7 @@ def _last_executed_query(self, sql, params):
# process during the .last_executed_query() call.
self.db._djdt_logger = None
try:
return self.db.ops.last_executed_query(
self.cursor, sql, self._quote_params(params)
)
return self.db.ops.last_executed_query(self.cursor, sql, params)
finally:
self.db._djdt_logger = self.logger

Expand Down
1 change: 1 addition & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Pending
-------

* Removed outdated third-party panels from the list.
* Avoided the unnecessary work of recursively quoting SQL parameters.
* Postponed context process in templates panel to include lazy evaluated
content.
* Fixed template panel to avoid evaluating ``LazyObject`` when not already evaluated.
Expand Down

0 comments on commit 498f434

Please sign in to comment.