From 46a07da6e84ab75f11048cdee405004223999d93 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Dec 2021 18:10:37 +0100 Subject: [PATCH 1/6] [pre-commit.ci] pre-commit autoupdate (#1541) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-eslint: v8.4.0 → v8.4.1](https://github.com/pre-commit/mirrors-eslint/compare/v8.4.0...v8.4.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 30f6b7bb0..bb1cd93f0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,7 +33,7 @@ repos: - id: prettier types_or: [javascript, css] - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.4.0 + rev: v8.4.1 hooks: - id: eslint files: \.js?$ From db07db7c67bc3777b0bd367092bf625f2f4c96dc Mon Sep 17 00:00:00 2001 From: Paolo Melchiorre Date: Wed, 15 Dec 2021 18:21:07 +0100 Subject: [PATCH 2/6] Update Django 4.0 stable versions --- setup.cfg | 1 + tox.ini | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/setup.cfg b/setup.cfg index 5cc680607..2dbccb970 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,7 @@ classifiers = Framework :: Django :: 2.2 Framework :: Django :: 3.1 Framework :: Django :: 3.2 + Framework :: Django :: 4.0 Intended Audience :: Developers License :: OSI Approved :: BSD License Operating System :: OS Independent diff --git a/tox.ini b/tox.ini index 3abd404bc..5d5e6b86e 100644 --- a/tox.ini +++ b/tox.ini @@ -8,10 +8,10 @@ envlist = [testenv] deps = - dj22: Django==2.2.* - dj31: Django==3.1.* - dj32: Django>=3.2,<4.0 - dj40: Django>=4.0rc1,<4.1 + dj22: django~=2.2.17 + dj31: django~=3.1.3 + dj32: django~=3.2.9 + dj40: django~=4.0.0 sqlite: mock postgresql: psycopg2-binary postgis: psycopg2-binary @@ -43,19 +43,19 @@ whitelist_externals = make pip_pre = True commands = make coverage TEST_ARGS='{posargs:tests}' -[testenv:py{36,37,38,39,310}-dj{22,31,32}-postgresql] +[testenv:py{36,37,38,39,310}-dj{22,31,32,40,main}}-postgresql] setenv = {[testenv]setenv} DB_BACKEND = postgresql DB_PORT = {env:DB_PORT:5432} -[testenv:py{36,37,38,39,310}-dj{22,31,32}-mysql] +[testenv:py{36,37,38,39,310}-dj{22,31,32,40,main}}-mysql] setenv = {[testenv]setenv} DB_BACKEND = mysql DB_PORT = {env:DB_PORT:3306} -[testenv:py{36,37,38,39,310}-dj{22,31,32,main}-sqlite] +[testenv:py{36,37,38,39,310}-dj{22,31,32,40,main}-sqlite] setenv = {[testenv]setenv} DB_BACKEND = sqlite3 From 4adfcc1e9bcc187a655f4539628f55cf2d04d790 Mon Sep 17 00:00:00 2001 From: Paolo Melchiorre Date: Wed, 15 Dec 2021 18:25:42 +0100 Subject: [PATCH 3/6] Align README badges with other jazzband projects --- README.rst | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 818b78514..7eab74138 100644 --- a/README.rst +++ b/README.rst @@ -1,24 +1,34 @@ -==================== -Django Debug Toolbar -==================== +===================================== +Django Debug Toolbar |latest-version| +===================================== -.. image:: https://jazzband.co/static/img/badge.svg +|jazzband| |build-status| |codecov| |docs| |python-support| |django-support| + +.. |latest-version| image:: https://img.shields.io/pypi/v/django-debug-toolbar.svg + :target: https://pypi.python.org/pypi/django-debug-toolbar + :alt: Latest version on PyPI + +.. |jazzband| image:: https://jazzband.co/static/img/badge.svg :target: https://jazzband.co/ :alt: Jazzband -.. image:: https://github.com/jazzband/django-debug-toolbar/workflows/Test/badge.svg +.. |build-status| image:: https://github.com/jazzband/django-debug-toolbar/workflows/Test/badge.svg :target: https://github.com/jazzband/django-debug-toolbar/actions :alt: Build Status -.. image:: https://codecov.io/gh/jazzband/django-debug-toolbar/branch/main/graph/badge.svg +.. |codecov| image:: https://codecov.io/gh/jazzband/django-debug-toolbar/branch/main/graph/badge.svg :target: https://codecov.io/gh/jazzband/django-debug-toolbar :alt: Test coverage status -.. image:: https://img.shields.io/pypi/pyversions/django-debug-toolbar +.. |docs| image:: https://img.shields.io/readthedocs/django-debug-toolbar/latest.svg + :target: https://readthedocs.org/projects/django-debug-toolbar/ + :alt: Documentation status + +.. |python-support| image:: https://img.shields.io/pypi/pyversions/django-debug-toolbar :target: https://pypi.python.org/pypi/django-debug-toolbar :alt: Supported Python versions -.. image:: https://img.shields.io/pypi/djversions/django-debug-toolbar +.. |django-support| image:: https://img.shields.io/pypi/djversions/django-debug-toolbar :target: https://pypi.org/project/django-debug-toolbar :alt: Supported Django versions From 69506fb6c30893990f567c2621117c0db2d4ea2c Mon Sep 17 00:00:00 2001 From: Tim Schilling Date: Wed, 15 Dec 2021 12:01:24 -0600 Subject: [PATCH 4/6] Clean up tox.ini syntax. --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 5d5e6b86e..dcbd607ff 100644 --- a/tox.ini +++ b/tox.ini @@ -43,13 +43,13 @@ whitelist_externals = make pip_pre = True commands = make coverage TEST_ARGS='{posargs:tests}' -[testenv:py{36,37,38,39,310}-dj{22,31,32,40,main}}-postgresql] +[testenv:py{36,37,38,39,310}-dj{22,31,32,40,main}-postgresql] setenv = {[testenv]setenv} DB_BACKEND = postgresql DB_PORT = {env:DB_PORT:5432} -[testenv:py{36,37,38,39,310}-dj{22,31,32,40,main}}-mysql] +[testenv:py{36,37,38,39,310}-dj{22,31,32,40,main}-mysql] setenv = {[testenv]setenv} DB_BACKEND = mysql From c2a9041ad3ed9625fe3c376ea9f25559432c7e01 Mon Sep 17 00:00:00 2001 From: Tim Schilling Date: Wed, 15 Dec 2021 12:04:17 -0600 Subject: [PATCH 5/6] Revert PR 1426 - PostGIS param stripping. The stripping logic is stripping general sql parameters and the test written for it does not run. I'm not confident that the test actually hits the code we expect it to run either. Closes #1543 Reopens #423 --- .github/workflows/test.yml | 5 +++-- debug_toolbar/panels/sql/tracking.py | 8 -------- docs/changes.rst | 3 +++ tests/settings.py | 2 +- tests/test_integration.py | 25 ------------------------- tox.ini | 6 ++++++ 6 files changed, 13 insertions(+), 36 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 050d5b11d..c8a661cfe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -82,10 +82,11 @@ jobs: max-parallel: 5 matrix: python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + database: [postgresql, postgis] services: postgres: - image: postgres + image: postgis/postgis:14-3.1 env: POSTGRES_DB: debug_toolbar POSTGRES_USER: debug_toolbar @@ -133,7 +134,7 @@ jobs: - name: Test with tox run: tox env: - DB_BACKEND: postgresql + DB_BACKEND: ${{ matrix.database }} DB_HOST: localhost DB_PORT: 5432 diff --git a/debug_toolbar/panels/sql/tracking.py b/debug_toolbar/panels/sql/tracking.py index 7090ac613..2ed691344 100644 --- a/debug_toolbar/panels/sql/tracking.py +++ b/debug_toolbar/panels/sql/tracking.py @@ -137,14 +137,6 @@ def _decode(self, param): def _record(self, method, sql, params): start_time = time() try: - if isinstance(params, list): - - def strip_GeomFromEWKB(param): - if isinstance(param, str): - return param.lstrip("ST_GeomFromEWKB('\\x").rstrip("'::bytea)") - return param - - params = [strip_GeomFromEWKB(param) for param in params] return method(sql, params) finally: stop_time = time() diff --git a/docs/changes.rst b/docs/changes.rst index 5c623e79f..799c6f295 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -4,6 +4,9 @@ Change log Next version ------------ +* Revert PR 1426 - Fixes issue with SQL parameters having leading and + trailing characters stripped away. + 3.2.3 (2021-12-12) ------------------ diff --git a/tests/settings.py b/tests/settings.py index 63456a2f6..c09506087 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -27,7 +27,7 @@ "tests", ] -USE_GIS = os.getenv("DB_BACKEND") in ("postgis",) +USE_GIS = os.getenv("DB_BACKEND") == "postgis" if USE_GIS: INSTALLED_APPS = ["django.contrib.gis"] + INSTALLED_APPS diff --git a/tests/test_integration.py b/tests/test_integration.py index 006ab93ee..ff6d32d9f 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -1,11 +1,9 @@ -import json import os import re import unittest import django import html5lib -from django.conf import settings from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.core import signing from django.core.cache import cache @@ -18,7 +16,6 @@ from debug_toolbar.forms import SignedDataForm from debug_toolbar.middleware import DebugToolbarMiddleware, show_toolbar from debug_toolbar.panels import Panel -from debug_toolbar.panels.sql.forms import SQLSelectForm from debug_toolbar.toolbar import DebugToolbar from .base import BaseTestCase, IntegrationTestCase @@ -310,28 +307,6 @@ def test_sql_explain_checks_show_toolbar(self): ) self.assertEqual(response.status_code, 404) - @unittest.skipUnless(settings.USE_GIS, "Test only valid with gis support") - def test_sql_explain_gis(self): - from django.contrib.gis.geos import GEOSGeometry - - from .models import Location - - db_table = Location._meta.db_table - - url = "/__debug__/sql_explain/" - geom = GEOSGeometry("POLYGON((0 0, 0 1, 1 1, 0 0))") - data = { - "sql": f'SELECT "{db_table}"."point" FROM "{db_table}" WHERE "{db_table}"."point" @ {geom.hex} LIMIT 1', - "raw_sql": f'SELECT "{db_table}"."point" FROM "{db_table}" WHERE "{db_table}"."point" @ %s LIMIT 1', - "params": json.dumps([geom.hex]), - "alias": "default", - "duration": "0", - } - data["hash"] = SQLSelectForm().make_hash(data) - - response = self.client.post(url, data=data) - self.assertEqual(response.status_code, 200) - @unittest.skipUnless( connection.vendor == "postgresql", "Test valid only on PostgreSQL" ) diff --git a/tox.ini b/tox.ini index dcbd607ff..13bf73037 100644 --- a/tox.ini +++ b/tox.ini @@ -49,6 +49,12 @@ setenv = DB_BACKEND = postgresql DB_PORT = {env:DB_PORT:5432} +[testenv:py{36,37,38,39,310}-dj{22,31,32,40,main}-postgis] +setenv = + {[testenv]setenv} + DB_BACKEND = postgis + DB_PORT = {env:DB_PORT:5432} + [testenv:py{36,37,38,39,310}-dj{22,31,32,40,main}-mysql] setenv = {[testenv]setenv} From 9ec7210e7ec638114f1fb283ca3ac8d566914997 Mon Sep 17 00:00:00 2001 From: Tim Schilling Date: Wed, 15 Dec 2021 14:39:45 -0600 Subject: [PATCH 6/6] Version 3.2.4 --- README.rst | 2 +- debug_toolbar/__init__.py | 2 +- docs/changes.rst | 3 +++ docs/conf.py | 2 +- setup.cfg | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 7eab74138..c147abf4f 100644 --- a/README.rst +++ b/README.rst @@ -44,7 +44,7 @@ Here's a screenshot of the toolbar in action: In addition to the built-in panels, a number of third-party panels are contributed by the community. -The current stable version of the Debug Toolbar is 3.2.3. It works on +The current stable version of the Debug Toolbar is 3.2.4. It works on Django ≥ 2.2. Documentation, including installation and configuration instructions, is diff --git a/debug_toolbar/__init__.py b/debug_toolbar/__init__.py index 6a03ec8f3..401de16c1 100644 --- a/debug_toolbar/__init__.py +++ b/debug_toolbar/__init__.py @@ -7,7 +7,7 @@ # Do not use pkg_resources to find the version but set it here directly! # see issue #1446 -VERSION = "3.2.3" +VERSION = "3.2.4" # Code that discovers files or modules in INSTALLED_APPS imports this module. diff --git a/docs/changes.rst b/docs/changes.rst index 799c6f295..025146a08 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -4,6 +4,9 @@ Change log Next version ------------ +3.2.4 (2021-12-15) +------------------ + * Revert PR 1426 - Fixes issue with SQL parameters having leading and trailing characters stripped away. diff --git a/docs/conf.py b/docs/conf.py index b01ba395f..fbe6907e6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,7 +25,7 @@ copyright = copyright.format(datetime.date.today().year) # The full version, including alpha/beta/rc tags -release = "3.2.3" +release = "3.2.4" # -- General configuration --------------------------------------------------- diff --git a/setup.cfg b/setup.cfg index 2dbccb970..82793f42a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = django-debug-toolbar -version = 3.2.3 +version = 3.2.4 description = A configurable set of panels that display various debug information about the current request/response. long_description = file: README.rst long_description_content_type = text/x-rst