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/.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?$ diff --git a/README.rst b/README.rst index 818b78514..c147abf4f 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 @@ -34,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/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..025146a08 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -4,6 +4,12 @@ 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. + 3.2.3 (2021-12-12) ------------------ 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 5cc680607..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 @@ -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/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 3abd404bc..13bf73037 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,25 @@ 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}-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} 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