[Python-modules-commits] [python-django-debug-toolbar] 03/07: Imported Upstream version 1.6

Andrew Starr-Bochicchio asb at moszumanska.debian.org
Sun Nov 27 15:48:40 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 e3e16caeb734bae169eb3b6dac195c86da61bf9d
Author: Andrew Starr-Bochicchio <a.starr.b at gmail.com>
Date:   Sun Nov 27 10:23:28 2016 -0500

    Imported Upstream version 1.6
---
 .coveragerc                                        |   6 +
 .travis.yml                                        |  39 +-
 CONTRIBUTING.md                                    |   7 +
 MANIFEST.in                                        |   1 +
 Makefile                                           |   4 +-
 README.rst                                         |  25 +-
 debug_toolbar/apps.py                              |  65 +++-
 debug_toolbar/locale/ru/LC_MESSAGES/django.mo      | Bin 9925 -> 11667 bytes
 debug_toolbar/locale/ru/LC_MESSAGES/django.po      | 395 +++++++++++----------
 debug_toolbar/middleware.py                        |  17 +-
 debug_toolbar/panels/versions.py                   |   9 +-
 debug_toolbar/settings.py                          |  86 -----
 debug_toolbar/static/debug_toolbar/js/toolbar.js   |   4 +-
 .../templates/debug_toolbar/panels/versions.html   |   6 +-
 docs/changes.rst                                   |  19 +
 docs/conf.py                                       |   4 +-
 docs/configuration.rst                             |   7 -
 docs/contributing.rst                              |  14 +-
 docs/installation.rst                              |  81 +----
 example/settings.py                                |  22 +-
 example/urls.py                                    |   7 +
 setup.py                                           |   5 +-
 tests/middleware.py                                |   7 +
 tests/settings.py                                  |  10 +-
 tests/test_integration.py                          |  69 ++++
 tox.ini                                            |  42 ++-
 26 files changed, 533 insertions(+), 418 deletions(-)

diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 0000000..0e2d03b
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,6 @@
+[run]
+source = debug_toolbar
+branch = 1
+
+[report]
+omit = *tests*,*migrations*
diff --git a/.travis.yml b/.travis.yml
index f6983bc..538d1ac 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,26 +1,23 @@
 language: python
 sudo: false
-python:
-  - "2.7"
-  - "3.3"
-  - "3.4"
-  - "3.5"
+python: 3.5
+cache: pip
 env:
-  - DJANGO="Django>=1.8.0,<1.9.0"
-  - DJANGO="Django>=1.9.0,<1.10.0"
-  - DJANGO="Django>=1.10a,<1.11.0"
-matrix:
-  exclude:
-    - python: "3.3"
-      env: DJANGO="Django>=1.9.0,<1.10.0"
-    - python: "3.3"
-      env: DJANGO="Django>=1.10a,<1.11.0"
-    - python: "3.5"
-      env: DJANGO="Django>=1.8.0,<1.9.0"
+  - TOXENV="py27-dj18"
+  - TOXENV="py33-dj18"
+  - TOXENV="py34-dj18"
+  - TOXENV="py27-dj19"
+  - TOXENV="py27-dj110"
+  - TOXENV="py34-dj19"
+  - TOXENV="py34-dj110"
+  - TOXENV="py35-dj19"
+  - TOXENV="py35-dj110"
+  - TOXENV="flake8"
+  - TOXENV="isort"
+  - TOXENV="readme"
 install:
-  - travis_retry pip install sqlparse
-  - travis_retry pip install --pre $DJANGO
-  - pip install -e .
+  - pip install tox codecov
 script:
-  - make jshint
-  - make test
+  - tox -v
+after_success:
+  - codecov
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..829a22a
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,7 @@
+[![Jazzband](https://jazzband.co/static/img/jazzband.svg)](https://jazzband.co/)
+
+This is a [Jazzband](https://jazzband.co/) project. By contributing you agree to abide by the [Contributor Code of Conduct](https://jazzband.co/about/conduct) and follow the [guidelines](https://jazzband.co/about/guidelines).
+
+Please see the
+[full contributing documentation](https://django-debug-toolbar.readthedocs.io/en/stable/contributing.html)
+for more help.
diff --git a/MANIFEST.in b/MANIFEST.in
index fedd1d4..e3d4782 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,6 @@
 include LICENSE
 include README.rst
+include CONTRIBUTING.md
 recursive-include debug_toolbar/locale *
 recursive-include debug_toolbar/static *
 recursive-include debug_toolbar/templates *
diff --git a/Makefile b/Makefile
index 5e97cf0..3d6d015 100644
--- a/Makefile
+++ b/Makefile
@@ -28,9 +28,11 @@ test_selenium:
 		django-admin test tests
 
 coverage:
+	python --version
 	coverage erase
 	DJANGO_SETTINGS_MODULE=tests.settings \
-		coverage run --branch --source=debug_toolbar `which django-admin` test tests
+		coverage run `which django-admin` test -v2 tests
+	coverage report
 	coverage html
 
 translatable_strings:
diff --git a/README.rst b/README.rst
index 76bd273..0bd577e 100644
--- a/README.rst
+++ b/README.rst
@@ -2,9 +2,21 @@
 Django Debug Toolbar
 ====================
 
-.. image:: https://secure.travis-ci.org/django-debug-toolbar/django-debug-toolbar.png
-    :alt: Build Status
-    :target: http://travis-ci.org/django-debug-toolbar/django-debug-toolbar
+.. image:: https://jazzband.co/static/img/badge.svg
+   :target: https://jazzband.co/
+   :alt: Jazzband
+
+.. image:: https://travis-ci.org/jazzband/django-debug-toolbar.svg?branch=master
+   :target: https://travis-ci.org/jazzband/django-debug-toolbar
+   :alt: Build Status
+
+.. image:: https://codecov.io/gh/jazzband/django-debug-toolbar/branch/master/graph/badge.svg
+   :target: https://codecov.io/gh/jazzband/django-debug-toolbar
+   :alt: Test coverage status
+
+.. image:: https://requires.io/github/jazzband/django-debug-toolbar/requirements.svg?branch=master
+     :target: https://requires.io/github/jazzband/django-debug-toolbar/requirements/?branch=master
+     :alt: Requirements Status
 
 The Django Debug Toolbar is a configurable set of panels that display various
 debug information about the current request/response and when clicked, display
@@ -12,15 +24,14 @@ more details about the panel's content.
 
 Here's a screenshot of the toolbar in action:
 
-.. image:: https://raw.github.com/django-debug-toolbar/django-debug-toolbar/master/example/django-debug-toolbar.png
+.. image:: https://raw.github.com/jazzband/django-debug-toolbar/master/example/django-debug-toolbar.png
    :width: 908
    :height: 557
 
 In addition to the built-in panels, a number of third-party panels are
 contributed by the community.
 
-The current version of the Debug Toolbar is 1.5 (in development). It works
-on Django ≥ 1.8.
+The current version of the Debug Toolbar is 1.6. It works on Django ≥ 1.8.
 
 Documentation, including installation and configuration instructions, is
 available at https://django-debug-toolbar.readthedocs.io/.
@@ -31,4 +42,4 @@ itself. If you like it, please consider contributing!
 The Django Debug Toolbar was originally created by Rob Hudson <rob at cogit8.org>
 in August 2008 and was further developed by many contributors_.
 
-.. _contributors: https://github.com/django-debug-toolbar/django-debug-toolbar/graphs/contributors
+.. _contributors: https://github.com/jazzband/django-debug-toolbar/graphs/contributors
diff --git a/debug_toolbar/apps.py b/debug_toolbar/apps.py
index 09c489f..a170c8f 100644
--- a/debug_toolbar/apps.py
+++ b/debug_toolbar/apps.py
@@ -1,16 +1,71 @@
 from __future__ import absolute_import, unicode_literals
 
+import inspect
+
 from django.apps import AppConfig
+from django.conf import settings
+from django.core.checks import Error, register
+from django.middleware.gzip import GZipMiddleware
+from django.utils.module_loading import import_string
 from django.utils.translation import ugettext_lazy as _
 
-from debug_toolbar import settings as dt_settings
+from debug_toolbar.middleware import DebugToolbarMiddleware
 
 
 class DebugToolbarConfig(AppConfig):
     name = 'debug_toolbar'
     verbose_name = _("Debug Toolbar")
 
-    def ready(self):
-        if dt_settings.get_patch_settings():
-            dt_settings.patch_all()
-        dt_settings.check_middleware()
+
+ at register
+def check_middleware(app_configs, **kwargs):
+    errors = []
+    gzip_index = None
+    debug_toolbar_index = None
+
+    setting = getattr(settings, 'MIDDLEWARE', None)
+    setting_name = 'MIDDLEWARE'
+    if setting is None:
+        setting = settings.MIDDLEWARE_CLASSES
+        setting_name = 'MIDDLEWARE_CLASSES'
+
+    # Determine the indexes which gzip and/or the toolbar are installed at
+    for i, middleware in enumerate(setting):
+        if is_middleware_class(GZipMiddleware, middleware):
+            gzip_index = i
+        elif is_middleware_class(DebugToolbarMiddleware, middleware):
+            debug_toolbar_index = i
+
+    if debug_toolbar_index is None:
+        # If the toolbar does not appear, report an error.
+        errors.append(
+            Error(
+                "debug_toolbar.middleware.DebugToolbarMiddleware is missing "
+                "from %s." % setting_name,
+                hint="Add debug_toolbar.middleware.DebugToolbarMiddleware to "
+                "%s." % setting_name,
+            )
+        )
+    elif gzip_index is not None and debug_toolbar_index < gzip_index:
+        # If the toolbar appears before the gzip index, report an error.
+        errors.append(
+            Error(
+                "debug_toolbar.middleware.DebugToolbarMiddleware occurs before "
+                "django.middleware.gzip.GZipMiddleware in %s." % setting_name,
+                hint="Move debug_toolbar.middleware.DebugToolbarMiddleware to "
+                "after django.middleware.gzip.GZipMiddleware in %s." % setting_name,
+            )
+        )
+
+    return errors
+
+
+def is_middleware_class(middleware_class, middleware_path):
+    try:
+        middleware_cls = import_string(middleware_path)
+    except ImportError:
+        return
+    return (
+        inspect.isclass(middleware_cls) and
+        issubclass(middleware_cls, middleware_class)
+    )
diff --git a/debug_toolbar/locale/ru/LC_MESSAGES/django.mo b/debug_toolbar/locale/ru/LC_MESSAGES/django.mo
index de94dc7..f67bfb0 100644
Binary files a/debug_toolbar/locale/ru/LC_MESSAGES/django.mo and b/debug_toolbar/locale/ru/LC_MESSAGES/django.mo differ
diff --git a/debug_toolbar/locale/ru/LC_MESSAGES/django.po b/debug_toolbar/locale/ru/LC_MESSAGES/django.po
index 3615b0c..7e8aa78 100644
--- a/debug_toolbar/locale/ru/LC_MESSAGES/django.po
+++ b/debug_toolbar/locale/ru/LC_MESSAGES/django.po
@@ -1,7 +1,7 @@
 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
 # This file is distributed under the same license as the PACKAGE package.
-# 
-# 
+#
+#
 # Translators:
 # Ilya Baryshev <baryshev at gmail.com>, 2013
 # Mikhail Korobov, 2009
@@ -10,55 +10,52 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Django Debug Toolbar\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-04-25 21:52+0200\n"
-"PO-Revision-Date: 2014-04-25 19:53+0000\n"
-"Last-Translator: Aymeric Augustin <aymeric.augustin at m4x.org>\n"
-"Language-Team: Russian (http://www.transifex.com/projects/p/django-debug-toolbar/language/ru/)\n"
+"POT-Creation-Date: 2016-07-21 16:45+0600\n"
+"PO-Revision-Date: 2016-07-21 17:22+0600\n"
+"Last-Translator: Igor 'idle sign' Starikov <idlesign at yandex.ru>\n"
+"Language-Team: Russian (http://www.transifex.com/projects/p/django-debug-"
+"toolbar/language/ru/)\n"
+"Language: ru\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"Language: ru\n"
-"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+"X-Generator: Poedit 1.8.7.1\n"
 
 #: apps.py:11
 msgid "Debug Toolbar"
-msgstr ""
-
-#: views.py:14
-msgid ""
-"Data for this panel isn't available anymore. Please reload the page and "
-"retry."
-msgstr "Данные этой панели больше недоступны. Пожалуйста, перезагрузите страницу и попробуйте ещё раз."
+msgstr "Отладочная панель"
 
-#: panels/cache.py:191
+#: panels/cache.py:204
 msgid "Cache"
-msgstr "Кэш"
+msgstr "Кеш"
 
-#: panels/cache.py:196
+#: panels/cache.py:209
 #, python-format
 msgid "%(cache_calls)d call in %(time).2fms"
 msgid_plural "%(cache_calls)d calls in %(time).2fms"
-msgstr[0] "%(cache_calls)d обращение за %(time).2fms"
-msgstr[1] "%(cache_calls)d обращения за %(time).2fms"
-msgstr[2] "%(cache_calls)d обращений за %(time).2fms"
+msgstr[0] "%(cache_calls)d обращение за %(time).2f мс"
+msgstr[1] "%(cache_calls)d обращения за %(time).2f мс"
+msgstr[2] "%(cache_calls)d обращений за %(time).2f мс"
 
-#: panels/cache.py:204
+#: panels/cache.py:217
 #, python-format
 msgid "Cache calls from %(count)d backend"
 msgid_plural "Cache calls from %(count)d backends"
-msgstr[0] "Обращения к кэшу от %(count)d бэкенда"
-msgstr[1] "Обращения к кэшу от %(count)d бэкендов"
-msgstr[2] "Обращения к кэшу от %(count)d бэкендов"
+msgstr[0] "Обращения к кешу от %(count)d бэкенда"
+msgstr[1] "Обращения к кешу от %(count)d бэкендов"
+msgstr[2] "Обращения к кешу от %(count)d бэкендов"
 
-#: panels/headers.py:35
+#: panels/headers.py:34
 msgid "Headers"
 msgstr "Заголовки"
 
-#: panels/logging.py:64
+#: panels/logging.py:66
 msgid "Logging"
 msgstr "Логи"
 
-#: panels/logging.py:70
+#: panels/logging.py:72
 #, python-format
 msgid "%(count)s message"
 msgid_plural "%(count)s messages"
@@ -66,17 +63,17 @@ msgstr[0] "%(count)s сообщение"
 msgstr[1] "%(count)s сообщений"
 msgstr[2] "%(count)s сообщений"
 
-#: panels/logging.py:73
+#: panels/logging.py:75
 msgid "Log messages"
 msgstr "Сообщения в логе"
 
-#: panels/profiling.py:127
+#: panels/profiling.py:144
 msgid "Profiling"
 msgstr "Профилирование"
 
-#: panels/redirects.py:17
+#: panels/redirects.py:16
 msgid "Intercept redirects"
-msgstr "Перехват редиректов"
+msgstr "Перехватывать перенаправления"
 
 #: panels/request.py:18
 msgid "Request"
@@ -84,22 +81,22 @@ msgstr "Запрос"
 
 #: panels/request.py:35
 msgid "<no view>"
-msgstr "<нет view>"
+msgstr "<нет представления>"
 
 #: panels/request.py:47
 msgid "<unavailable>"
 msgstr "<недоступно>"
 
-#: panels/settings.py:20
+#: panels/settings.py:18
 msgid "Settings"
 msgstr "Настройки"
 
-#: panels/settings.py:23
+#: panels/settings.py:21
 #, python-format
 msgid "Settings from <code>%s</code>"
 msgstr "Настройки из <code>%s</code>"
 
-#: panels/signals.py:45
+#: panels/signals.py:44
 #, python-format
 msgid "%(num_receivers)d receiver of 1 signal"
 msgid_plural "%(num_receivers)d receivers of 1 signal"
@@ -107,7 +104,7 @@ msgstr[0] "%(num_receivers)d получатель 1 сигнала"
 msgstr[1] "%(num_receivers)d получателя 1 сигнала"
 msgstr[2] "%(num_receivers)d получателей 1 сигнала"
 
-#: panels/signals.py:48
+#: panels/signals.py:47
 #, python-format
 msgid "%(num_receivers)d receiver of %(num_signals)d signals"
 msgid_plural "%(num_receivers)d receivers of %(num_signals)d signals"
@@ -115,146 +112,150 @@ msgstr[0] "%(num_receivers)d получатель %(num_signals)d сигнала
 msgstr[1] "%(num_receivers)d получателя %(num_signals)d сигнала(ов)"
 msgstr[2] "%(num_receivers)d получателей %(num_signals)d сигнала(ов)"
 
-#: panels/signals.py:53
+#: panels/signals.py:52
 msgid "Signals"
 msgstr "Сигналы"
 
-#: panels/staticfiles.py:89
+#: panels/sql/panel.py:25
+msgid "Autocommit"
+msgstr "Autocommit"
+
+#: panels/sql/panel.py:26
+msgid "Read uncommitted"
+msgstr "Read uncommitted"
+
+#: panels/sql/panel.py:27
+msgid "Read committed"
+msgstr "Read committed"
+
+#: panels/sql/panel.py:28
+msgid "Repeatable read"
+msgstr "Repeatable read"
+
+#: panels/sql/panel.py:29
+msgid "Serializable"
+msgstr "Сериализуемый"
+
+#: panels/sql/panel.py:40
+msgid "Idle"
+msgstr "Ожидание"
+
+#: panels/sql/panel.py:41
+msgid "Active"
+msgstr "Действие"
+
+#: panels/sql/panel.py:42
+msgid "In transaction"
+msgstr "В транзакции"
+
+#: panels/sql/panel.py:43
+msgid "In error"
+msgstr "Ошибка"
+
+#: panels/sql/panel.py:44
+msgid "Unknown"
+msgstr "Неизвестно"
+
+#: panels/sql/panel.py:108
+msgid "SQL"
+msgstr "SQL"
+
+#: panels/staticfiles.py:87
 #, python-format
 msgid "Static files (%(num_found)s found, %(num_used)s used)"
-msgstr ""
+msgstr "Файлов статики (вего: %(num_found)s, использовано: %(num_used)s)"
 
-#: panels/staticfiles.py:107
+#: panels/staticfiles.py:105
 msgid "Static files"
-msgstr ""
+msgstr "Статика"
 
-#: panels/staticfiles.py:112
+#: panels/staticfiles.py:110
 #, python-format
 msgid "%(num_used)s file used"
 msgid_plural "%(num_used)s files used"
-msgstr[0] ""
-msgstr[1] ""
-msgstr[2] ""
+msgstr[0] "%(num_used)s файл используется"
+msgstr[1] "%(num_used)s файла используются"
+msgstr[2] "%(num_used)s файлов используются"
 
-#: panels/timer.py:23
+#: panels/templates/panel.py:128
+msgid "Templates"
+msgstr "Шаблоны"
+
+#: panels/templates/panel.py:133
+#, python-format
+msgid "Templates (%(num_templates)s rendered)"
+msgstr "Шаблоны (обработано %(num_templates)s)"
+
+#: panels/templates/panel.py:164
+msgid "No origin"
+msgstr "Нет источника"
+
+#: panels/timer.py:26
 #, python-format
 msgid "CPU: %(cum)0.2fms (%(total)0.2fms)"
-msgstr "CPU: %(cum)0.2fms (%(total)0.2fms)"
+msgstr "CPU: %(cum)0.2f мс (%(total)0.2f мс)"
 
-#: panels/timer.py:28
+#: panels/timer.py:31
 #, python-format
 msgid "Total: %0.2fms"
-msgstr "Итого: %0.2fms"
+msgstr "Итого: %0.2f мс"
 
-#: panels/timer.py:34 templates/debug_toolbar/panels/logging.html:7
+#: panels/timer.py:37 templates/debug_toolbar/panels/logging.html:7
 #: templates/debug_toolbar/panels/sql_explain.html:11
 #: templates/debug_toolbar/panels/sql_profile.html:12
 #: templates/debug_toolbar/panels/sql_select.html:11
 msgid "Time"
 msgstr "Время"
 
-#: panels/timer.py:42
+#: panels/timer.py:45
 msgid "User CPU time"
-msgstr "User CPU time"
+msgstr "Пользовательское время ядра"
 
-#: panels/timer.py:42
+#: panels/timer.py:45
 #, python-format
 msgid "%(utime)0.3f msec"
 msgstr "%(utime)0.3f мс"
 
-#: panels/timer.py:43
+#: panels/timer.py:46
 msgid "System CPU time"
-msgstr "System CPU time"
+msgstr "Системное время ядра"
 
-#: panels/timer.py:43
+#: panels/timer.py:46
 #, python-format
 msgid "%(stime)0.3f msec"
 msgstr "%(stime)0.3f мс"
 
-#: panels/timer.py:44
+#: panels/timer.py:47
 msgid "Total CPU time"
-msgstr "Total CPU time"
+msgstr "Общее время ядра"
 
-#: panels/timer.py:44
+#: panels/timer.py:47
 #, python-format
 msgid "%(total)0.3f msec"
 msgstr "%(total)0.3f мс"
 
-#: panels/timer.py:45
+#: panels/timer.py:48
 msgid "Elapsed time"
 msgstr "Затраченное время"
 
-#: panels/timer.py:45
+#: panels/timer.py:48
 #, python-format
 msgid "%(total_time)0.3f msec"
 msgstr "%(total_time)0.3f мс"
 
-#: panels/timer.py:46
+#: panels/timer.py:49
 msgid "Context switches"
-msgstr "Переключений контекста"
+msgstr "Переключения контекста"
 
-#: panels/timer.py:46
+#: panels/timer.py:49
 #, python-format
 msgid "%(vcsw)d voluntary, %(ivcsw)d involuntary"
 msgstr "%(vcsw)d намеренных, %(ivcsw)d вынужденных"
 
-#: panels/versions.py:25
+#: panels/versions.py:20
 msgid "Versions"
 msgstr "Версии"
 
-#: panels/sql/panel.py:22
-msgid "Autocommit"
-msgstr "Autocommit"
-
-#: panels/sql/panel.py:23
-msgid "Read uncommitted"
-msgstr "Read uncommitted"
-
-#: panels/sql/panel.py:24
-msgid "Read committed"
-msgstr "Read committed"
-
-#: panels/sql/panel.py:25
-msgid "Repeatable read"
-msgstr "Repeatable read"
-
-#: panels/sql/panel.py:26
-msgid "Serializable"
-msgstr "Serializable"
-
-#: panels/sql/panel.py:37
-msgid "Idle"
-msgstr "Ожидание"
-
-#: panels/sql/panel.py:38
-msgid "Active"
-msgstr "Действие"
-
-#: panels/sql/panel.py:39
-msgid "In transaction"
-msgstr "В транзакции"
-
-#: panels/sql/panel.py:40
-msgid "In error"
-msgstr "Ошибка"
-
-#: panels/sql/panel.py:41
-msgid "Unknown"
-msgstr "Неизвестно"
-
-#: panels/sql/panel.py:105
-msgid "SQL"
-msgstr "SQL"
-
-#: panels/templates/panel.py:141
-msgid "Templates"
-msgstr "Шаблоны"
-
-#: panels/templates/panel.py:146
-#, python-format
-msgid "Templates (%(num_templates)s rendered)"
-msgstr "Шаблоны (обработано %(num_templates)s)"
-
 #: templates/debug_toolbar/base.html:19
 msgid "Hide toolbar"
 msgstr "Скрыть панель"
@@ -275,21 +276,6 @@ msgstr "Включить для последующих запросов"
 msgid "Show toolbar"
 msgstr "Показать панель"
 
-#: templates/debug_toolbar/base.html:53
-msgid "Close"
-msgstr "Закрыть"
-
-#: templates/debug_toolbar/redirect.html:8
-msgid "Location:"
-msgstr ""
-
-#: templates/debug_toolbar/redirect.html:10
-msgid ""
-"The Django Debug Toolbar has intercepted a redirect to the above URL for "
-"debug viewing purposes. You can click the above link to continue with the "
-"redirect as normal."
-msgstr "Django Debug Toolbar в перехватил редирект на адрес, указанный выше. Вы можете нажать на ссылку, чтобы выполнить переход самостоятельно."
-
 #: templates/debug_toolbar/panels/cache.html:2
 msgid "Summary"
 msgstr "Сводка"
@@ -304,11 +290,11 @@ msgstr "Общее время"
 
 #: templates/debug_toolbar/panels/cache.html:8
 msgid "Cache hits"
-msgstr "Cache хитов"
+msgstr "Попадания"
 
 #: templates/debug_toolbar/panels/cache.html:9
 msgid "Cache misses"
-msgstr "Промахи кэша"
+msgstr "Промахи"
 
 #: templates/debug_toolbar/panels/cache.html:21
 msgid "Commands"
@@ -319,7 +305,7 @@ msgid "Calls"
 msgstr "Вызовы"
 
 #: templates/debug_toolbar/panels/cache.html:43
-#: templates/debug_toolbar/panels/sql.html:20
+#: templates/debug_toolbar/panels/sql.html:23
 msgid "Time (ms)"
 msgstr "Время (мс)"
 
@@ -375,7 +361,9 @@ msgstr "WSGI-окружение"
 msgid ""
 "Since the WSGI environ inherits the environment of the server, only a "
 "significant subset is shown below."
-msgstr "Так как WSGI-окружение наследует окружение сервера, ниже отображены лишь те из переменных, которые важны для нужд отладки."
+msgstr ""
+"Так как WSGI-окружение наследует окружение сервера, ниже отображены лишь те "
+"из переменных, которые важны для нужд отладки."
 
 #: templates/debug_toolbar/panels/logging.html:6
 msgid "Level"
@@ -390,7 +378,7 @@ msgid "Message"
 msgstr "Сообщение"
 
 #: templates/debug_toolbar/panels/logging.html:10
-#: templates/debug_toolbar/panels/staticfiles.html:45
+#: templates/debug_toolbar/panels/staticfiles.html:44
 msgid "Location"
 msgstr "Место"
 
@@ -421,19 +409,19 @@ msgstr "Кол-во"
 
 #: templates/debug_toolbar/panels/request.html:3
 msgid "View information"
-msgstr "View"
+msgstr "Информация о представлении"
 
 #: templates/debug_toolbar/panels/request.html:7
 msgid "View function"
-msgstr "View функция"
+msgstr "Функция представления"
 
 #: templates/debug_toolbar/panels/request.html:10
 msgid "URL name"
-msgstr "URL Name"
+msgstr "Имя URL"
 
 #: templates/debug_toolbar/panels/request.html:24
 msgid "Cookies"
-msgstr "Cookies"
+msgstr "Куки"
 
 #: templates/debug_toolbar/panels/request.html:32
 #: templates/debug_toolbar/panels/request.html:58
@@ -444,7 +432,7 @@ msgstr "Переменная"
 
 #: templates/debug_toolbar/panels/request.html:46
 msgid "No cookies"
-msgstr "Нет cookies"
+msgstr "Нет куков"
 
 #: templates/debug_toolbar/panels/request.html:50
 msgid "Session data"
@@ -480,7 +468,7 @@ msgstr "Сигнал"
 
 #: templates/debug_toolbar/panels/signals.html:6
 msgid "Providing"
-msgstr ""
+msgstr "Аргументы"
 
 #: templates/debug_toolbar/panels/signals.html:7
 msgid "Receivers"
@@ -494,45 +482,49 @@ msgstr[0] "%(num)s запрос"
 msgstr[1] "%(num)s запроса"
 msgstr[2] "%(num)s запросов"
 
-#: templates/debug_toolbar/panels/sql.html:18
+#: templates/debug_toolbar/panels/sql.html:9
+#, python-format
+msgid "including %(dupes)s duplicates"
+msgstr "включая дублей: %(dupes)s"
+
+#: templates/debug_toolbar/panels/sql.html:21
 msgid "Query"
 msgstr "Запрос"
 
-#: templates/debug_toolbar/panels/sql.html:19
+#: templates/debug_toolbar/panels/sql.html:22
 #: templates/debug_toolbar/panels/timer.html:36
 msgid "Timeline"
 msgstr "Временная диаграмма"
 
-#: templates/debug_toolbar/panels/sql.html:21
+#: templates/debug_toolbar/panels/sql.html:24
 msgid "Action"
 msgstr "Действие"
 
-#: templates/debug_toolbar/panels/sql.html:64
+#: templates/debug_toolbar/panels/sql.html:41
+#, python-format
+msgid "Duplicated %(dupes)s times."
+msgstr "Дублей: %(dupes)s."
+
+#: templates/debug_toolbar/panels/sql.html:73
 msgid "Connection:"
 msgstr "Соединение:"
 
-#: templates/debug_toolbar/panels/sql.html:66
+#: templates/debug_toolbar/panels/sql.html:75
 msgid "Isolation level:"
 msgstr "Уровень изоляции:"
 
-#: templates/debug_toolbar/panels/sql.html:69
+#: templates/debug_toolbar/panels/sql.html:78
 msgid "Transaction status:"
 msgstr "Статус транзакции:"
 
-#: templates/debug_toolbar/panels/sql.html:83
+#: templates/debug_toolbar/panels/sql.html:92
 msgid "(unknown)"
 msgstr "(неизвестно)"
 
-#: templates/debug_toolbar/panels/sql.html:92
+#: templates/debug_toolbar/panels/sql.html:101
 msgid "No SQL queries were recorded during this request."
-msgstr "Во время обработки этого HTTP-запроса не было записано ни одного SQL-запроса."
-
-#: templates/debug_toolbar/panels/sql_explain.html:3
-#: templates/debug_toolbar/panels/sql_profile.html:3
-#: templates/debug_toolbar/panels/sql_select.html:3
-#: templates/debug_toolbar/panels/template_source.html:3
-msgid "Back"
-msgstr "Назад"
+msgstr ""
+"Во время обработки этого HTTP-запроса не было записано ни одного SQL-запроса."
 
 #: templates/debug_toolbar/panels/sql_explain.html:4
 msgid "SQL explained"
@@ -566,52 +558,52 @@ msgstr "Выбранные SQL-запросы"
 msgid "Empty set"
 msgstr "Ничего, ноль строк"
 
-#: templates/debug_toolbar/panels/staticfiles.html:4
+#: templates/debug_toolbar/panels/staticfiles.html:3
 msgid "Static file path"
 msgid_plural "Static file paths"
-msgstr[0] ""
-msgstr[1] ""
-msgstr[2] ""
+msgstr[0] "Путь к статике"
+msgstr[1] "Пути к статике"
+msgstr[2] "Пути к статике"
 
-#: templates/debug_toolbar/panels/staticfiles.html:8
+#: templates/debug_toolbar/panels/staticfiles.html:7
 #, python-format
 msgid "(prefix %(prefix)s)"
-msgstr ""
+msgstr "(префикс %(prefix)s)"
 
-#: templates/debug_toolbar/panels/staticfiles.html:12
-#: templates/debug_toolbar/panels/staticfiles.html:23
-#: templates/debug_toolbar/panels/staticfiles.html:35
+#: templates/debug_toolbar/panels/staticfiles.html:11
+#: templates/debug_toolbar/panels/staticfiles.html:22
+#: templates/debug_toolbar/panels/staticfiles.html:34
 #: templates/debug_toolbar/panels/templates.html:10
 #: templates/debug_toolbar/panels/templates.html:28
 #: templates/debug_toolbar/panels/templates.html:43
 msgid "None"
 msgstr "Нет"
 
-#: templates/debug_toolbar/panels/staticfiles.html:15
+#: templates/debug_toolbar/panels/staticfiles.html:14
 msgid "Static file app"
 msgid_plural "Static file apps"
-msgstr[0] ""
-msgstr[1] ""
-msgstr[2] ""
+msgstr[0] "Приложение со статикой"
+msgstr[1] "Приложения со статикой"
+msgstr[2] "Приложения со статикой"
 
-#: templates/debug_toolbar/panels/staticfiles.html:26
+#: templates/debug_toolbar/panels/staticfiles.html:25
 msgid "Static file"
 msgid_plural "Static files"
-msgstr[0] ""
-msgstr[1] ""
-msgstr[2] ""
+msgstr[0] "Файл статики"
+msgstr[1] "Файлы статики"
+msgstr[2] "Файлы статики"
 
-#: templates/debug_toolbar/panels/staticfiles.html:40
+#: templates/debug_toolbar/panels/staticfiles.html:39
 #, python-format
 msgid "%(payload_count)s file"
 msgid_plural "%(payload_count)s files"
-msgstr[0] ""
-msgstr[1] ""
-msgstr[2] ""
+msgstr[0] "%(payload_count)s файл"
+msgstr[1] "%(payload_count)s файла"
+msgstr[2] "%(payload_count)s файлов"
 
-#: templates/debug_toolbar/panels/staticfiles.html:44
+#: templates/debug_toolbar/panels/staticfiles.html:43
 msgid "Path"
-msgstr ""
+msgstr "Путь"
 
 #: templates/debug_toolbar/panels/template_source.html:4
 msgid "Template source:"
@@ -663,10 +655,41 @@ msgstr "Событие"
 msgid "Milliseconds since navigation start (+length)"
 msgstr "С начала навигации в мс (+продолжительность)"
 
-#: templates/debug_toolbar/panels/versions.html:5
+#: templates/debug_toolbar/panels/versions.html:7
+msgid "Package"
+msgstr "Пакет"
+
+#: templates/debug_toolbar/panels/versions.html:8
 msgid "Name"
 msgstr "Название"
 
-#: templates/debug_toolbar/panels/versions.html:6
+#: templates/debug_toolbar/panels/versions.html:9
 msgid "Version"
 msgstr "Версия"
+
+#: templates/debug_toolbar/redirect.html:8
+msgid "Location:"
+msgstr "Место:"
+
+#: templates/debug_toolbar/redirect.html:10
+msgid ""
+"The Django Debug Toolbar has intercepted a redirect to the above URL for "
+"debug viewing purposes. You can click the above link to continue with the "
+"redirect as normal."
+msgstr ""
+"Django Debug Toolbar перехватил перенаправление на адрес, указанный выше. Вы "
+"можете нажать на ссылку, чтобы выполнить переход самостоятельно."
+
+#: views.py:14
+msgid ""
+"Data for this panel isn't available anymore. Please reload the page and "
+"retry."
+msgstr ""
+"Данные этой панели больше недоступны. Пожалуйста, перезагрузите страницу и "
+"попробуйте ещё раз."
+
+#~ msgid "Close"
+#~ msgstr "Закрыть"
+
+#~ msgid "Back"
+#~ msgstr "Назад"
diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py
index 1fb3e27..4b91bae 100644
--- a/debug_toolbar/middleware.py
+++ b/debug_toolbar/middleware.py
@@ -10,11 +10,19 @@ import threading
 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 @@ def show_toolbar(request):
     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):
... 716 lines suppressed ...

-- 
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