[Python-modules-commits] [python-django-debug-toolbar] 05/08: django-1.10-compat.patch: Make DebugToolarMiddleware compatible with Django 1.10's MIDDLEWARE setting (Closes: #828664).
Andrew Starr-Bochicchio
asb at moszumanska.debian.org
Sat Aug 20 17:34:04 UTC 2016
This is an automated email from the git hooks/post-receive script.
asb pushed a commit to branch master
in repository python-django-debug-toolbar.
commit 1a58c1078b4ee57f855d337047edec79aec88010
Author: Andrew Starr-Bochicchio <a.starr.b at gmail.com>
Date: Sat Aug 20 12:09:24 2016 -0400
django-1.10-compat.patch: Make DebugToolarMiddleware compatible with Django 1.10's MIDDLEWARE setting (Closes: #828664).
---
.gitignore | 1 +
debian/changelog | 2 +
debian/patches/django-1.10-compat.patch | 92 +++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
4 files changed, 96 insertions(+)
diff --git a/.gitignore b/.gitignore
index 07f47b5..06954a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ example/db.sqlite3
htmlcov
.tox
node_modules
+.pc
diff --git a/debian/changelog b/debian/changelog
index a539b75..6365f71 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ python-django-debug-toolbar (1:1.5-1) UNRELEASED; urgency=medium
[ Andrew Starr-Bochicchio ]
* New upstream release.
* Bump Standards-Version to 3.9.8, no changes.
+ * django-1.10-compat.patch: Make DebugToolarMiddleware compatible
+ with Django 1.10's MIDDLEWARE setting (Closes: #828664).
-- Ondřej Nový <novy at ondrej.org> Tue, 29 Mar 2016 21:59:22 +0200
diff --git a/debian/patches/django-1.10-compat.patch b/debian/patches/django-1.10-compat.patch
new file mode 100644
index 0000000..c42f8b9
--- /dev/null
+++ b/debian/patches/django-1.10-compat.patch
@@ -0,0 +1,92 @@
+From 388e177eb19a2b51f7663003a1aa509ee56bbb7a Mon Sep 17 00:00:00 2001
+From: Matthias Kestenholz <mk at feinheit.ch>
+Date: Wed, 27 Jul 2016 16:44:46 +0200
+Debian-Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=828664
+Subject: [PATCH] Make DebugToolarMiddleware compatible with Django 1.10's
+ MIDDLEWARE setting
+
+Fixes #853.
+---
+ debug_toolbar/middleware.py | 17 +++++++++++++----
+ docs/changes.rst | 17 +++++++++++++++++
+ 2 files changed, 30 insertions(+), 4 deletions(-)
+
+Index: python-django-debug-toolbar/debug_toolbar/middleware.py
+===================================================================
+--- python-django-debug-toolbar.orig/debug_toolbar/middleware.py 2016-08-20 12:06:55.180481913 -0400
++++ python-django-debug-toolbar/debug_toolbar/middleware.py 2016-08-20 12:06:55.156481477 -0400
+@@ -10,11 +10,19 @@
+ from django.conf import settings
+ from django.utils import six
+ from django.utils.encoding import force_text
++from django.utils.functional import cached_property
+ from django.utils.module_loading import import_string
+
+ from debug_toolbar import settings as dt_settings
+ from debug_toolbar.toolbar import DebugToolbar
+
++try:
++ from django.utils.deprecation import MiddlewareMixin
++except ImportError: # Django < 1.10
++ # Works perfectly for everyone using MIDDLEWARE_CLASSES
++ MiddlewareMixin = object
++
++
+ _HTML_TYPES = ('text/html', 'application/xhtml+xml')
+
+
+@@ -31,21 +39,22 @@
+ return bool(settings.DEBUG)
+
+
+-class DebugToolbarMiddleware(object):
++class DebugToolbarMiddleware(MiddlewareMixin):
+ """
+ Middleware to set up Debug Toolbar on incoming request and render toolbar
+ on outgoing response.
+ """
+ debug_toolbars = {}
+
+- def __init__(self):
++ @cached_property
++ def show_toolbar(self):
+ # If SHOW_TOOLBAR_CALLBACK is a string, which is the recommended
+ # setup, resolve it to the corresponding callable.
+ func_or_path = dt_settings.get_config()['SHOW_TOOLBAR_CALLBACK']
+ if isinstance(func_or_path, six.string_types):
+- self.show_toolbar = import_string(func_or_path)
++ return import_string(func_or_path)
+ else:
+- self.show_toolbar = func_or_path
++ return func_or_path
+
+ def process_request(self, request):
+ # Decide whether the toolbar is active for this request.
+Index: python-django-debug-toolbar/docs/changes.rst
+===================================================================
+--- python-django-debug-toolbar.orig/docs/changes.rst 2016-08-20 12:06:55.180481913 -0400
++++ python-django-debug-toolbar/docs/changes.rst 2016-08-20 12:06:55.156481477 -0400
+@@ -1,6 +1,23 @@
+ Change log
+ ==========
+
++1.6 (upcoming)
++--------------
++
++Removed features
++~~~~~~~~~~~~~~~~
++
++* Support for automatic setup has been removed. Installation now requires
++ explicit setup. As a result, the ``DEBUG_TOOLBAR_PATCH_SETTINGS`` setting has
++ also been removed. See the :doc:`installation documentation <installation>`
++ for details.
++
++Bugfixes
++~~~~~~~~
++
++* The ``DebugToolbarMiddleware`` now also supports Django 1.10's ``MIDDLEWARE``
++ setting.
++
+ 1.5
+ ---
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..a6dd669
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+django-1.10-compat.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-django-debug-toolbar.git
More information about the Python-modules-commits
mailing list