diff options
58 files changed, 384 insertions, 312 deletions
| @@ -19,7 +19,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 version of the Debug Toolbar is 1.0. It works on Django 1.4, 1.5 +The current version of the Debug Toolbar is 1.0.1. It works on Django 1.4, 1.5  and 1.6.  If you're using Django 1.4, you will need Django ≥ 1.4.2 and Python ≥ 2.6.5. diff --git a/debug_toolbar/apps.py b/debug_toolbar/apps.py new file mode 100644 index 0000000..17f8dad --- /dev/null +++ b/debug_toolbar/apps.py @@ -0,0 +1,15 @@ +from __future__ import absolute_import, unicode_literals + +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + +from debug_toolbar import settings as dt_settings + + +class DebugToolbarConfig(AppConfig): +    name = 'debug_toolbar' +    verbose_name = _("Debug Toolbar") + +    def ready(self): +        if dt_settings.PATCH_SETTINGS: +            dt_settings.patch_all() diff --git a/debug_toolbar/locale/ca/LC_MESSAGES/django.mo b/debug_toolbar/locale/ca/LC_MESSAGES/django.moBinary files differ index 9592bee..081e4b4 100644 --- a/debug_toolbar/locale/ca/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/ca/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/ca/LC_MESSAGES/django.po b/debug_toolbar/locale/ca/LC_MESSAGES/django.po index 78ddaad..64837aa 100644 --- a/debug_toolbar/locale/ca/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/ca/LC_MESSAGES/django.po @@ -8,9 +8,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 14:20+0000\n" -"Last-Translator: Libre El Chaval <el.libre@gmail.com>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Catalan (http://www.transifex.com/projects/p/django-debug-toolbar/language/ca/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -559,6 +559,11 @@ msgid_plural "Static file paths"  msgstr[0] ""  msgstr[1] "" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/cs/LC_MESSAGES/django.mo b/debug_toolbar/locale/cs/LC_MESSAGES/django.moBinary files differ index 7cfffdb..3d68227 100644 --- a/debug_toolbar/locale/cs/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/cs/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/cs/LC_MESSAGES/django.po b/debug_toolbar/locale/cs/LC_MESSAGES/django.po index 6a0b8ef..8e8e2c0 100644 --- a/debug_toolbar/locale/cs/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/cs/LC_MESSAGES/django.po @@ -8,8 +8,8 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-16 08:50+0000\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 09:30+0000\n"  "Last-Translator: Vlada Macek <macek@sandbox.cz>\n"  "Language-Team: Czech (http://www.transifex.com/projects/p/django-debug-toolbar/language/cs/)\n"  "MIME-Version: 1.0\n" @@ -567,6 +567,11 @@ msgstr[0] "Cesta ke statickým souborům"  msgstr[1] "Cesty ke statickým souborům"  msgstr[2] "Cesty ke statickým souborům" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "(prefix %(prefix)s)" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/de/LC_MESSAGES/django.mo b/debug_toolbar/locale/de/LC_MESSAGES/django.moBinary files differ index 37638c2..f95f3d5 100644 --- a/debug_toolbar/locale/de/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/de/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/de/LC_MESSAGES/django.po b/debug_toolbar/locale/de/LC_MESSAGES/django.po index f72ecbd..8e89f35 100644 --- a/debug_toolbar/locale/de/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/de/LC_MESSAGES/django.po @@ -8,8 +8,8 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 20:10+0000\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n"  "Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: German (http://www.transifex.com/projects/p/django-debug-toolbar/language/de/)\n"  "MIME-Version: 1.0\n" @@ -559,6 +559,11 @@ msgid_plural "Static file paths"  msgstr[0] "Pfad mit statischen Dateien"  msgstr[1] "Pfade mit statischen Dateien" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/en/LC_MESSAGES/django.mo b/debug_toolbar/locale/en/LC_MESSAGES/django.moBinary files differ index eb931bb..8749e16 100644 --- a/debug_toolbar/locale/en/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/en/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/es/LC_MESSAGES/django.mo b/debug_toolbar/locale/es/LC_MESSAGES/django.moBinary files differ index 97a4228..cc0654e 100644 --- a/debug_toolbar/locale/es/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/es/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/es/LC_MESSAGES/django.po b/debug_toolbar/locale/es/LC_MESSAGES/django.po index 716f624..a885086 100644 --- a/debug_toolbar/locale/es/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/es/LC_MESSAGES/django.po @@ -9,9 +9,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 12:13+0000\n" -"Last-Translator: Aymeric Augustin <aymeric.augustin@m4x.org>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Spanish (http://www.transifex.com/projects/p/django-debug-toolbar/language/es/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -560,6 +560,11 @@ msgid_plural "Static file paths"  msgstr[0] ""  msgstr[1] "" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/fi/LC_MESSAGES/django.mo b/debug_toolbar/locale/fi/LC_MESSAGES/django.moBinary files differ index 1435ac4..219dd38 100644 --- a/debug_toolbar/locale/fi/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/fi/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/fi/LC_MESSAGES/django.po b/debug_toolbar/locale/fi/LC_MESSAGES/django.po index 38ec494..1101096 100644 --- a/debug_toolbar/locale/fi/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/fi/LC_MESSAGES/django.po @@ -8,9 +8,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 12:40+0000\n" -"Last-Translator: Aymeric Augustin <aymeric.augustin@m4x.org>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Finnish (http://www.transifex.com/projects/p/django-debug-toolbar/language/fi/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -559,6 +559,11 @@ msgid_plural "Static file paths"  msgstr[0] ""  msgstr[1] "" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/fr/LC_MESSAGES/django.mo b/debug_toolbar/locale/fr/LC_MESSAGES/django.moBinary files differ index 5e69739..6087ee5 100644 --- a/debug_toolbar/locale/fr/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/fr/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/fr/LC_MESSAGES/django.po b/debug_toolbar/locale/fr/LC_MESSAGES/django.po index c80f5b4..64b3faf 100644 --- a/debug_toolbar/locale/fr/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/fr/LC_MESSAGES/django.po @@ -11,9 +11,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 19:10+0000\n" -"Last-Translator: claudep <claude@2xlibre.net>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: French (http://www.transifex.com/projects/p/django-debug-toolbar/language/fr/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -562,6 +562,11 @@ msgid_plural "Static file paths"  msgstr[0] "Chemin de fichier statique"  msgstr[1] "Chemins de fichiers statiques" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/he/LC_MESSAGES/django.mo b/debug_toolbar/locale/he/LC_MESSAGES/django.moBinary files differ index 48a6406..7247c9b 100644 --- a/debug_toolbar/locale/he/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/he/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/he/LC_MESSAGES/django.po b/debug_toolbar/locale/he/LC_MESSAGES/django.po index 814dbfb..296f9e8 100644 --- a/debug_toolbar/locale/he/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/he/LC_MESSAGES/django.po @@ -8,9 +8,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 12:13+0000\n" -"Last-Translator: Aymeric Augustin <aymeric.augustin@m4x.org>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Hebrew (http://www.transifex.com/projects/p/django-debug-toolbar/language/he/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -559,6 +559,11 @@ msgid_plural "Static file paths"  msgstr[0] ""  msgstr[1] "" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/id/LC_MESSAGES/django.mo b/debug_toolbar/locale/id/LC_MESSAGES/django.moBinary files differ index 2400d40..040c6b6 100644 --- a/debug_toolbar/locale/id/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/id/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/id/LC_MESSAGES/django.po b/debug_toolbar/locale/id/LC_MESSAGES/django.po index 1aa11d3..bbad0fd 100644 --- a/debug_toolbar/locale/id/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/id/LC_MESSAGES/django.po @@ -8,9 +8,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 12:40+0000\n" -"Last-Translator: Aymeric Augustin <aymeric.augustin@m4x.org>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Indonesian (http://www.transifex.com/projects/p/django-debug-toolbar/language/id/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -551,6 +551,11 @@ msgid "Static file path"  msgid_plural "Static file paths"  msgstr[0] "" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/it/LC_MESSAGES/django.mo b/debug_toolbar/locale/it/LC_MESSAGES/django.moBinary files differ index d569875..6f97766 100644 --- a/debug_toolbar/locale/it/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/it/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/it/LC_MESSAGES/django.po b/debug_toolbar/locale/it/LC_MESSAGES/django.po index 989f83d..1bfd6af 100644 --- a/debug_toolbar/locale/it/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/it/LC_MESSAGES/django.po @@ -10,9 +10,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 14:40+0000\n" -"Last-Translator: yakky <i.spalletti@nephila.it>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Italian (http://www.transifex.com/projects/p/django-debug-toolbar/language/it/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -561,6 +561,11 @@ msgid_plural "Static file paths"  msgstr[0] "Percorso file statici"  msgstr[1] "Percorsi file statici" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/nl/LC_MESSAGES/django.mo b/debug_toolbar/locale/nl/LC_MESSAGES/django.moBinary files differ index 8ee7f7c..504db4e 100644 --- a/debug_toolbar/locale/nl/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/nl/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/nl/LC_MESSAGES/django.po b/debug_toolbar/locale/nl/LC_MESSAGES/django.po index 5926c03..89d7abc 100644 --- a/debug_toolbar/locale/nl/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/nl/LC_MESSAGES/django.po @@ -8,9 +8,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 12:13+0000\n" -"Last-Translator: Aymeric Augustin <aymeric.augustin@m4x.org>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Dutch (http://www.transifex.com/projects/p/django-debug-toolbar/language/nl/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -559,6 +559,11 @@ msgid_plural "Static file paths"  msgstr[0] ""  msgstr[1] "" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/pl/LC_MESSAGES/django.mo b/debug_toolbar/locale/pl/LC_MESSAGES/django.moBinary files differ index 404bc7a..8f67a7d 100644 --- a/debug_toolbar/locale/pl/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/pl/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/pl/LC_MESSAGES/django.po b/debug_toolbar/locale/pl/LC_MESSAGES/django.po index 57f0a2a..904ccc5 100644 --- a/debug_toolbar/locale/pl/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/pl/LC_MESSAGES/django.po @@ -8,9 +8,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 12:13+0000\n" -"Last-Translator: Aymeric Augustin <aymeric.augustin@m4x.org>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Polish (http://www.transifex.com/projects/p/django-debug-toolbar/language/pl/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -567,6 +567,11 @@ msgstr[0] ""  msgstr[1] ""  msgstr[2] "" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/pt/LC_MESSAGES/django.mo b/debug_toolbar/locale/pt/LC_MESSAGES/django.moBinary files differ index f44a21c..7dbadc3 100644 --- a/debug_toolbar/locale/pt/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/pt/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/pt/LC_MESSAGES/django.po b/debug_toolbar/locale/pt/LC_MESSAGES/django.po index 7e9e3f4..26f13ba 100644 --- a/debug_toolbar/locale/pt/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/pt/LC_MESSAGES/django.po @@ -7,9 +7,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 12:13+0000\n" -"Last-Translator: Aymeric Augustin <aymeric.augustin@m4x.org>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Portuguese (http://www.transifex.com/projects/p/django-debug-toolbar/language/pt/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -558,6 +558,11 @@ msgid_plural "Static file paths"  msgstr[0] ""  msgstr[1] "" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/pt_BR/LC_MESSAGES/django.mo b/debug_toolbar/locale/pt_BR/LC_MESSAGES/django.moBinary files differ index 5c94722..d333ae3 100644 --- a/debug_toolbar/locale/pt_BR/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/pt_BR/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/pt_BR/LC_MESSAGES/django.po b/debug_toolbar/locale/pt_BR/LC_MESSAGES/django.po index 1b41b01..9f6d595 100644 --- a/debug_toolbar/locale/pt_BR/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/pt_BR/LC_MESSAGES/django.po @@ -3,14 +3,14 @@  #   #   # Translators: -# Fábio <bnafta@gmail.com>, 2013 +# Fábio <bnafta@gmail.com>, 2013-2014  # Percy Pérez-Pinedo, 2009  msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-19 18:50+0000\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2014-01-01 13:00+0000\n"  "Last-Translator: Fábio <bnafta@gmail.com>\n"  "Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/django-debug-toolbar/language/pt_BR/)\n"  "MIME-Version: 1.0\n" @@ -560,6 +560,11 @@ msgid_plural "Static file paths"  msgstr[0] "Caminho do arquivo estático"  msgstr[1] "Caminho dos arquivos estáticos" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "(prefixo %(prefix)s)" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/ru/LC_MESSAGES/django.mo b/debug_toolbar/locale/ru/LC_MESSAGES/django.moBinary files differ index 3a6640c..aaa515f 100644 --- a/debug_toolbar/locale/ru/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/ru/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/ru/LC_MESSAGES/django.po b/debug_toolbar/locale/ru/LC_MESSAGES/django.po index ada3832..2287280 100644 --- a/debug_toolbar/locale/ru/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/ru/LC_MESSAGES/django.po @@ -10,9 +10,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 12:13+0000\n" -"Last-Translator: Aymeric Augustin <aymeric.augustin@m4x.org>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Russian (http://www.transifex.com/projects/p/django-debug-toolbar/language/ru/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -569,6 +569,11 @@ msgstr[0] ""  msgstr[1] ""  msgstr[2] "" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/sk/LC_MESSAGES/django.mo b/debug_toolbar/locale/sk/LC_MESSAGES/django.moBinary files differ index cdddea3..1532276 100644 --- a/debug_toolbar/locale/sk/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/sk/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/sk/LC_MESSAGES/django.po b/debug_toolbar/locale/sk/LC_MESSAGES/django.po index 5692eef..848055d 100644 --- a/debug_toolbar/locale/sk/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/sk/LC_MESSAGES/django.po @@ -10,8 +10,8 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-16 10:20+0000\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-29 21:50+0000\n"  "Last-Translator: Juraj Bubniak <translations@jbub.eu>\n"  "Language-Team: Slovak (http://www.transifex.com/projects/p/django-debug-toolbar/language/sk/)\n"  "MIME-Version: 1.0\n" @@ -72,7 +72,7 @@ msgstr "Analýza"  #: panels/redirects.py:22  msgid "Intercept redirects" -msgstr "" +msgstr "Zachytiť presmerovania"  #: panels/request.py:18  msgid "Request" @@ -118,7 +118,7 @@ msgstr "Signály"  #: panels/staticfiles.py:90  #, python-format  msgid "Static files (%(num_found)s found, %(num_used)s used)" -msgstr "" +msgstr "Statické súbory (%(num_found)s nájdených, %(num_used)s použitých)"  #: panels/staticfiles.py:115  msgid "Static files" @@ -128,9 +128,9 @@ msgstr "Statické súbory"  #, 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 použitý súbor" +msgstr[1] "%(num_used)s použitých súborov" +msgstr[2] "%(num_used)s použitých súborov"  #: panels/timer.py:23  #, python-format @@ -261,11 +261,11 @@ msgstr "Skryť"  #: templates/debug_toolbar/base.html:23  msgid "Disable for next and successive requests" -msgstr "" +msgstr "Zakázať pre ďalšie a nasledujúce požiadavky"  #: templates/debug_toolbar/base.html:23  msgid "Enable for next and successive requests" -msgstr "" +msgstr "Povoliť pre ďalšie a nasledujúce požiadavky"  #: templates/debug_toolbar/base.html:45  msgid "Show toolbar" @@ -331,7 +331,7 @@ msgstr "Argumenty"  #: templates/debug_toolbar/panels/cache.html:46  #: templates/debug_toolbar/panels/request.html:9  msgid "Keyword arguments" -msgstr "" +msgstr "Kľúčové argumenty"  #: templates/debug_toolbar/panels/cache.html:47  msgid "Backend" @@ -421,15 +421,15 @@ msgstr "Zobraziť informácie"  #: templates/debug_toolbar/panels/request.html:7  msgid "View function" -msgstr "" +msgstr "View funkcia"  #: templates/debug_toolbar/panels/request.html:10  msgid "URL name" -msgstr "" +msgstr "URL meno"  #: templates/debug_toolbar/panels/request.html:24  msgid "Cookies" -msgstr "" +msgstr "Cookies"  #: templates/debug_toolbar/panels/request.html:32  #: templates/debug_toolbar/panels/request.html:58 @@ -440,19 +440,19 @@ msgstr "Premenná"  #: templates/debug_toolbar/panels/request.html:46  msgid "No cookies" -msgstr "" +msgstr "Žiadne cookies"  #: templates/debug_toolbar/panels/request.html:50  msgid "Session data" -msgstr "" +msgstr "Dáta relácie"  #: templates/debug_toolbar/panels/request.html:72  msgid "No session data" -msgstr "" +msgstr "Žiadne dáta relácie"  #: templates/debug_toolbar/panels/request.html:76  msgid "GET data" -msgstr "" +msgstr "GET dáta"  #: templates/debug_toolbar/panels/request.html:98  msgid "No GET data" @@ -460,7 +460,7 @@ msgstr "Žiadne GET dáta"  #: templates/debug_toolbar/panels/request.html:102  msgid "POST data" -msgstr "" +msgstr "POST dáta"  #: templates/debug_toolbar/panels/request.html:123  msgid "No POST data" @@ -476,7 +476,7 @@ msgstr "Signál"  #: templates/debug_toolbar/panels/signals.html:6  msgid "Providing" -msgstr "" +msgstr "Poskytuje"  #: templates/debug_toolbar/panels/signals.html:7  msgid "Receivers" @@ -532,7 +532,7 @@ msgstr "Späť"  #: templates/debug_toolbar/panels/sql_explain.html:4  msgid "SQL explained" -msgstr "" +msgstr "SQL vysvetlené"  #: templates/debug_toolbar/panels/sql_explain.html:9  #: templates/debug_toolbar/panels/sql_profile.html:10 @@ -548,7 +548,7 @@ msgstr "Databáza"  #: templates/debug_toolbar/panels/sql_profile.html:4  msgid "SQL profiled" -msgstr "" +msgstr "SQL profilované"  #: templates/debug_toolbar/panels/sql_profile.html:37  msgid "Error" @@ -565,9 +565,14 @@ msgstr "Prázdny rad"  #: templates/debug_toolbar/panels/staticfiles.html:4  msgid "Static file path"  msgid_plural "Static file paths" -msgstr[0] "" -msgstr[1] "" -msgstr[2] "" +msgstr[0] "Cesta k statickému súboru" +msgstr[1] "Cesty k statickým súborom" +msgstr[2] "Cesty k statickým súborom" + +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "(prefix %(prefix)s)"  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23 @@ -581,9 +586,9 @@ msgstr "Žiadny"  #: templates/debug_toolbar/panels/staticfiles.html:15  msgid "Static file app"  msgid_plural "Static file apps" -msgstr[0] "" -msgstr[1] "" -msgstr[2] "" +msgstr[0] "Aplikácia pre statické súbory" +msgstr[1] "Aplikácie pre statické súbory" +msgstr[2] "Aplikácie pre statické súbory"  #: templates/debug_toolbar/panels/staticfiles.html:26  msgid "Static file" @@ -596,9 +601,9 @@ msgstr[2] "Statické súbory"  #, python-format  msgid "%(payload_count)s file"  msgid_plural "%(payload_count)s files" -msgstr[0] "" -msgstr[1] "" -msgstr[2] "" +msgstr[0] "%(payload_count)s súbor" +msgstr[1] "%(payload_count)s súborov" +msgstr[2] "%(payload_count)s súborov"  #: templates/debug_toolbar/panels/staticfiles.html:44  msgid "Path" @@ -606,7 +611,7 @@ msgstr "Cesta"  #: templates/debug_toolbar/panels/template_source.html:4  msgid "Template source:" -msgstr "" +msgstr "Zdrojový kód šablóny:"  #: templates/debug_toolbar/panels/templates.html:2  msgid "Template path" @@ -625,7 +630,7 @@ msgstr[2] "Šablóna"  #: templates/debug_toolbar/panels/templates.html:21  #: templates/debug_toolbar/panels/templates.html:37  msgid "Toggle context" -msgstr "" +msgstr "Prepnúť kontext"  #: templates/debug_toolbar/panels/templates.html:31  msgid "Context processor" @@ -636,7 +641,7 @@ msgstr[2] "Spracovateľ kontextu"  #: templates/debug_toolbar/panels/timer.html:2  msgid "Resource usage" -msgstr "" +msgstr "Využitie prostriedkov"  #: templates/debug_toolbar/panels/timer.html:10  msgid "Resource" @@ -644,11 +649,11 @@ msgstr "Prostriedok"  #: templates/debug_toolbar/panels/timer.html:26  msgid "Browser timing" -msgstr "" +msgstr "Čas prehliadača"  #: templates/debug_toolbar/panels/timer.html:35  msgid "Timing attribute" -msgstr "" +msgstr "Časový atribút"  #: templates/debug_toolbar/panels/timer.html:37  msgid "Milliseconds since navigation start (+length)" diff --git a/debug_toolbar/locale/sv_SE/LC_MESSAGES/django.mo b/debug_toolbar/locale/sv_SE/LC_MESSAGES/django.moBinary files differ index 4986bb3..66b94f8 100644 --- a/debug_toolbar/locale/sv_SE/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/sv_SE/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/sv_SE/LC_MESSAGES/django.po b/debug_toolbar/locale/sv_SE/LC_MESSAGES/django.po index 82665ef..647cfc7 100644 --- a/debug_toolbar/locale/sv_SE/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/sv_SE/LC_MESSAGES/django.po @@ -9,9 +9,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 12:40+0000\n" -"Last-Translator: Aymeric Augustin <aymeric.augustin@m4x.org>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Swedish (Sweden) (http://www.transifex.com/projects/p/django-debug-toolbar/language/sv_SE/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -560,6 +560,11 @@ msgid_plural "Static file paths"  msgstr[0] ""  msgstr[1] "" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/uk/LC_MESSAGES/django.mo b/debug_toolbar/locale/uk/LC_MESSAGES/django.moBinary files differ index 09c3ffb..e6fb88c 100644 --- a/debug_toolbar/locale/uk/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/uk/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/uk/LC_MESSAGES/django.po b/debug_toolbar/locale/uk/LC_MESSAGES/django.po index 60ec119..5accac8 100644 --- a/debug_toolbar/locale/uk/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/uk/LC_MESSAGES/django.po @@ -8,9 +8,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-15 12:13+0000\n" -"Last-Translator: Aymeric Augustin <aymeric.augustin@m4x.org>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Ukrainian (http://www.transifex.com/projects/p/django-debug-toolbar/language/uk/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -567,6 +567,11 @@ msgstr[0] ""  msgstr[1] ""  msgstr[2] "" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/locale/zh_CN/LC_MESSAGES/django.mo b/debug_toolbar/locale/zh_CN/LC_MESSAGES/django.moBinary files differ index e05ffb3..a611278 100644 --- a/debug_toolbar/locale/zh_CN/LC_MESSAGES/django.mo +++ b/debug_toolbar/locale/zh_CN/LC_MESSAGES/django.mo diff --git a/debug_toolbar/locale/zh_CN/LC_MESSAGES/django.po b/debug_toolbar/locale/zh_CN/LC_MESSAGES/django.po index e166b81..c353c26 100644 --- a/debug_toolbar/locale/zh_CN/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/zh_CN/LC_MESSAGES/django.po @@ -8,9 +8,9 @@ msgid ""  msgstr ""  "Project-Id-Version: Django Debug Toolbar\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" -"PO-Revision-Date: 2013-12-18 08:25+0000\n" -"Last-Translator: mozillazg <opensource.mozillazg@gmail.com>\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" +"PO-Revision-Date: 2013-12-24 08:56+0000\n" +"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"  "Language-Team: Chinese (China) (http://www.transifex.com/projects/p/django-debug-toolbar/language/zh_CN/)\n"  "MIME-Version: 1.0\n"  "Content-Type: text/plain; charset=UTF-8\n" @@ -551,6 +551,11 @@ msgid "Static file path"  msgid_plural "Static file paths"  msgstr[0] "静态文件路径" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" +  #: templates/debug_toolbar/panels/staticfiles.html:12  #: templates/debug_toolbar/panels/staticfiles.html:23  #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/management/commands/debugsqlshell.py b/debug_toolbar/management/commands/debugsqlshell.py index 2d4bfa6..7e1471f 100644 --- a/debug_toolbar/management/commands/debugsqlshell.py +++ b/debug_toolbar/management/commands/debugsqlshell.py @@ -4,12 +4,15 @@ from time import time  # 'debugsqlshell' is the same as the 'shell'.  from django.core.management.commands.shell import Command               # noqa -from django.db.backends import util +try: +    from django.db.backends import utils +except ImportError: +    from django.db.backends import util as utils  import sqlparse -class PrintQueryWrapper(util.CursorDebugWrapper): +class PrintQueryWrapper(utils.CursorDebugWrapper):      def execute(self, sql, params=()):          start_time = time()          try: @@ -22,4 +25,4 @@ class PrintQueryWrapper(util.CursorDebugWrapper):              print('%s [%.2fms]' % (formatted_sql, duration)) -util.CursorDebugWrapper = PrintQueryWrapper +utils.CursorDebugWrapper = PrintQueryWrapper diff --git a/debug_toolbar/models.py b/debug_toolbar/models.py index 4e624fa..1874748 100644 --- a/debug_toolbar/models.py +++ b/debug_toolbar/models.py @@ -1,63 +1,9 @@  from __future__ import absolute_import, unicode_literals -from django.conf import settings -from django.conf.urls import include, patterns, url -from django.core.urlresolvers import clear_url_caches, reverse, NoReverseMatch -from django.utils.importlib import import_module +import django -import debug_toolbar  from debug_toolbar import settings as dt_settings -from debug_toolbar.middleware import DebugToolbarMiddleware -def is_toolbar_middleware(middleware_path): -    # Replace this with import_by_path in Django >= 1.6. -    try: -        mod_path, cls_name = middleware_path.rsplit('.', 1) -        mod = import_module(mod_path) -        middleware_cls = getattr(mod, cls_name) -    except (AttributeError, ImportError, ValueError): -        return -    return issubclass(middleware_cls, DebugToolbarMiddleware) - - -def is_toolbar_middleware_installed(): -    return any(is_toolbar_middleware(middleware) -               for middleware in settings.MIDDLEWARE_CLASSES) - - -def prepend_to_setting(setting_name, value): -    """Insert value at the beginning of a list or tuple setting.""" -    values = getattr(settings, setting_name) -    # Make a list [value] or tuple (value,) -    value = type(values)((value,)) -    setattr(settings, setting_name, value + values) - - -def patch_internal_ips(): -    if not settings.INTERNAL_IPS: -        prepend_to_setting('INTERNAL_IPS', '127.0.0.1') -        prepend_to_setting('INTERNAL_IPS', '::1') - - -def patch_middleware_classes(): -    if not is_toolbar_middleware_installed(): -        prepend_to_setting('MIDDLEWARE_CLASSES', -                           'debug_toolbar.middleware.DebugToolbarMiddleware') - - -def patch_root_urlconf(): -    try: -        reverse('djdt:render_panel') -    except NoReverseMatch: -        urlconf_module = import_module(settings.ROOT_URLCONF) -        urlconf_module.urlpatterns = patterns('',                      # noqa -            url(r'^__debug__/', include(debug_toolbar.urls)), -        ) + urlconf_module.urlpatterns -        clear_url_caches() - - -if dt_settings.PATCH_SETTINGS: -    patch_internal_ips() -    patch_middleware_classes() -    patch_root_urlconf() +if dt_settings.PATCH_SETTINGS and django.VERSION[:2] < (1, 7): +    dt_settings.patch_all() diff --git a/debug_toolbar/panels/staticfiles.py b/debug_toolbar/panels/staticfiles.py index efaf841..daf8909 100644 --- a/debug_toolbar/panels/staticfiles.py +++ b/debug_toolbar/panels/staticfiles.py @@ -6,7 +6,6 @@ except ImportError:      threading = None  from django.conf import settings -from django.core.exceptions import ImproperlyConfigured  from django.core.files.storage import get_storage_class  from django.contrib.staticfiles import finders, storage  from django.contrib.staticfiles.templatetags import staticfiles @@ -102,13 +101,6 @@ class StaticFilesPanel(panels.Panel):          storage.staticfiles_storage = staticfiles.staticfiles_storage = _original_storage      @property -    def has_content(self): -        if "django.contrib.staticfiles" not in settings.INSTALLED_APPS: -            raise ImproperlyConfigured("Could not find staticfiles in " -                                       "INSTALLED_APPS setting.") -        return True - -    @property      def num_used(self):          return len(self._paths[threading.currentThread()]) diff --git a/debug_toolbar/panels/timer.py b/debug_toolbar/panels/timer.py index e19a15e..741f57a 100644 --- a/debug_toolbar/panels/timer.py +++ b/debug_toolbar/panels/timer.py @@ -6,7 +6,7 @@ except ImportError:      resource = None  import time  from django.template.loader import render_to_string -from django.utils.translation import ugettext as _ +from django.utils.translation import ugettext_lazy as _  from debug_toolbar.panels import Panel diff --git a/debug_toolbar/panels/versions.py b/debug_toolbar/panels/versions.py index 321ba6e..29f165b 100644 --- a/debug_toolbar/panels/versions.py +++ b/debug_toolbar/panels/versions.py @@ -27,28 +27,49 @@ class VersionsPanel(Panel):      template = 'debug_toolbar/panels/versions.html'      def process_response(self, request, response): -        versions = [('Python', '%d.%d.%d' % sys.version_info[:3])] -        for app in list(settings.INSTALLED_APPS) + ['django']: -            name = app.split('.')[-1].replace('_', ' ').capitalize() -            app = import_module(app) -            if hasattr(app, 'get_version'): -                get_version = app.get_version -                if callable(get_version): -                    version = get_version() -                else: -                    version = get_version -            elif hasattr(app, 'VERSION'): -                version = app.VERSION -            elif hasattr(app, '__version__'): -                version = app.__version__ -            else: -                continue -            if isinstance(version, (list, tuple)): -                version = '.'.join(str(o) for o in version) -            versions.append((name, version)) -            versions = sorted(versions, key=lambda version: version[0]) - +        versions = [ +            ('Python', '%d.%d.%d' % sys.version_info[:3]), +            ('Django', self.get_app_version(django)), +        ] +        if django.VERSION[:2] >= (1, 7): +            versions += list(self.gen_app_versions_1_7()) +        else: +            versions += list(self.gen_app_versions_1_6())          self.record_stats({ -            'versions': OrderedDict(versions), +            'versions': OrderedDict(sorted(versions, key=lambda v: v[0])),              'paths': sys.path,          }) + +    def gen_app_versions_1_7(self): +        from django.apps import apps +        for app_config in apps.get_app_configs(): +            name = app_config.verbose_name +            app = app_config.module +            version = self.get_app_version(app) +            if version: +                yield name, version + +    def gen_app_versions_1_6(self): +        for app in list(settings.INSTALLED_APPS): +            name = app.split('.')[-1].replace('_', ' ').capitalize() +            app = import_module(app) +            version = self.get_app_version(app) +            if version: +                yield name, version + +    def get_app_version(self, app): +        if hasattr(app, 'get_version'): +            get_version = app.get_version +            if callable(get_version): +                version = get_version() +            else: +                version = get_version +        elif hasattr(app, 'VERSION'): +            version = app.VERSION +        elif hasattr(app, '__version__'): +            version = app.__version__ +        else: +            return +        if isinstance(version, (list, tuple)): +            version = '.'.join(str(o) for o in version) +        return version diff --git a/debug_toolbar/settings.py b/debug_toolbar/settings.py index 5ed0005..48649fd 100644 --- a/debug_toolbar/settings.py +++ b/debug_toolbar/settings.py @@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals  import warnings  from django.conf import settings +from django.utils.importlib import import_module  from django.utils import six @@ -75,13 +76,12 @@ PANELS_DEFAULTS = [      'debug_toolbar.panels.headers.HeadersPanel',      'debug_toolbar.panels.request.RequestPanel',      'debug_toolbar.panels.sql.SQLPanel', -    'debug_toolbar.panels.templates.TemplatesPanel',      'debug_toolbar.panels.staticfiles.StaticFilesPanel', +    'debug_toolbar.panels.templates.TemplatesPanel',      'debug_toolbar.panels.cache.CachePanel',      'debug_toolbar.panels.signals.SignalsPanel',      'debug_toolbar.panels.logging.LoggingPanel',      'debug_toolbar.panels.redirects.RedirectsPanel', -    'debug_toolbar.panels.profiling.ProfilingPanel',  ]  try: @@ -126,3 +126,64 @@ else:  PATCH_SETTINGS = getattr(settings, 'DEBUG_TOOLBAR_PATCH_SETTINGS', settings.DEBUG) + + +# The following functions can monkey-patch settings automatically. Several +# imports are placed inside functions to make it safe to import this module. + + +def is_toolbar_middleware(middleware_path): +    from debug_toolbar.middleware import DebugToolbarMiddleware +    # This could be replaced by import_by_path in Django >= 1.6. +    try: +        mod_path, cls_name = middleware_path.rsplit('.', 1) +        mod = import_module(mod_path) +        middleware_cls = getattr(mod, cls_name) +    except (AttributeError, ImportError, ValueError): +        return +    return issubclass(middleware_cls, DebugToolbarMiddleware) + + +def is_toolbar_middleware_installed(): +    return any(is_toolbar_middleware(middleware) +               for middleware in settings.MIDDLEWARE_CLASSES) + + +def prepend_to_setting(setting_name, value): +    """Insert value at the beginning of a list or tuple setting.""" +    values = getattr(settings, setting_name) +    # Make a list [value] or tuple (value,) +    value = type(values)((value,)) +    setattr(settings, setting_name, value + values) + + +def patch_internal_ips(): +    if not settings.INTERNAL_IPS: +        prepend_to_setting('INTERNAL_IPS', '127.0.0.1') +        prepend_to_setting('INTERNAL_IPS', '::1') + + +def patch_middleware_classes(): +    if not is_toolbar_middleware_installed(): +        prepend_to_setting('MIDDLEWARE_CLASSES', +                           'debug_toolbar.middleware.DebugToolbarMiddleware') + + +def patch_root_urlconf(): +    from django.conf.urls import include, patterns, url +    from django.core.urlresolvers import clear_url_caches, reverse, NoReverseMatch +    import debug_toolbar +    try: +        reverse('djdt:render_panel') +    except NoReverseMatch: +        urlconf_module = import_module(settings.ROOT_URLCONF) +        urlconf_module.urlpatterns = patterns('',                      # noqa +            url(r'^__debug__/', include(debug_toolbar.urls)), +        ) + urlconf_module.urlpatterns +        clear_url_caches() + + +def patch_all(): +    patch_internal_ips() +    patch_middleware_classes() +    patch_root_urlconf() diff --git a/debug_toolbar/static/debug_toolbar/js/jquery.cookie.js b/debug_toolbar/static/debug_toolbar/js/jquery.cookie.js deleted file mode 100644 index a9da53b..0000000 --- a/debug_toolbar/static/debug_toolbar/js/jquery.cookie.js +++ /dev/null @@ -1,113 +0,0 @@ -/*! - * jQuery Cookie Plugin v1.4.0 - * https://github.com/carhartl/jquery-cookie - * - * Copyright 2013 Klaus Hartl - * Released under the MIT license - */ -(function (factory) { -    if (typeof define === 'function' && define.amd) { -        // AMD. Register as anonymous module. -        define(['jquery'], factory); -    } else { -        // Browser globals. -        factory(jQuery); -    } -}(function ($) { - -    var pluses = /\+/g; - -    function encode(s) { -        return config.raw ? s : encodeURIComponent(s); -    } - -    function decode(s) { -        return config.raw ? s : decodeURIComponent(s); -    } - -    function stringifyCookieValue(value) { -        return encode(config.json ? JSON.stringify(value) : String(value)); -    } - -    function parseCookieValue(s) { -        if (s.indexOf('"') === 0) { -            // This is a quoted cookie as according to RFC2068, unescape... -            s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); -        } - -        try { -            // Replace server-side written pluses with spaces. -            // If we can't decode the cookie, ignore it, it's unusable. -            // If we can't parse the cookie, ignore it, it's unusable. -            s = decodeURIComponent(s.replace(pluses, ' ')); -            return config.json ? JSON.parse(s) : s; -        } catch(e) {} -    } - -    function read(s, converter) { -        var value = config.raw ? s : parseCookieValue(s); -        return $.isFunction(converter) ? converter(value) : value; -    } - -    var config = $.cookie = function (key, value, options) { - -        // Write -        if (value !== undefined && !$.isFunction(value)) { -            options = $.extend({}, config.defaults, options); - -            if (typeof options.expires === 'number') { -                var days = options.expires, t = options.expires = new Date(); -                t.setDate(t.getDate() + days); -            } - -            return (document.cookie = [ -                encode(key), '=', stringifyCookieValue(value), -                options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE -                options.path    ? '; path=' + options.path : '', -                options.domain  ? '; domain=' + options.domain : '', -                options.secure  ? '; secure' : '' -            ].join('')); -        } - -        // Read - -        var result = key ? undefined : {}; - -        // To prevent the for loop in the first place assign an empty array -        // in case there are no cookies at all. Also prevents odd result when -        // calling $.cookie(). -        var cookies = document.cookie ? document.cookie.split('; ') : []; - -        for (var i = 0, l = cookies.length; i < l; i++) { -            var parts = cookies[i].split('='); -            var name = decode(parts.shift()); -            var cookie = parts.join('='); - -            if (key && key === name) { -                // If second argument (value) is a function it's a converter... -                result = read(cookie, value); -                break; -            } - -            // Prevent storing a cookie that we couldn't decode. -            if (!key && (cookie = read(cookie)) !== undefined) { -                result[name] = cookie; -            } -        } - -        return result; -    }; - -    config.defaults = {}; - -    $.removeCookie = function (key, options) { -        if ($.cookie(key) === undefined) { -            return false; -        } - -        // Must not alter options, thus extending a fresh object... -        $.cookie(key, '', $.extend({}, options, { expires: -1 })); -        return !$.cookie(key); -    }; - -})); diff --git a/debug_toolbar/static/debug_toolbar/js/toolbar.js b/debug_toolbar/static/debug_toolbar/js/toolbar.js index 6b5dffd..10a9c02 100644 --- a/debug_toolbar/static/debug_toolbar/js/toolbar.js +++ b/debug_toolbar/static/debug_toolbar/js/toolbar.js @@ -1,7 +1,7 @@  (function (factory) {      if (typeof define === 'function' && define.amd) {          // AMD. Register as anonymous module. -        define(['jquery', 'jquery.cookie'], factory); +        define(['jquery'], factory);      } else {          // Browser globals.          window.djdt = factory(jQuery); @@ -57,9 +57,9 @@                  return false;              });              $(document).on('click', '#djDebug .djDebugPanelButton input[type=checkbox]', function() { -                $.cookie($(this).attr('data-cookie'), $(this).prop('checked') ? 'on' : 'off', { +                djdt.cookie.set($(this).attr('data-cookie'), $(this).prop('checked') ? 'on' : 'off', {                      path: '/', -                    expires: 10, +                    expires: 10                  });              }); @@ -152,7 +152,7 @@                  $(document).off('mousemove');                  if (djdt.handleDragged) {                      var top = handle.offset().top; -                    $.cookie('djdttop', top, { +                    djdt.cookie.set('djdttop', top, {                          path: '/',                          expires: 10                      }); @@ -180,7 +180,7 @@                      return;                  }              }); -            if ($.cookie('djdt') == 'hide') { +            if (djdt.cookie.get('djdt') == 'hide') {                  djdt.hide_toolbar(false);              } else {                  djdt.show_toolbar(false); @@ -209,14 +209,14 @@              $('#djDebugToolbar').hide('fast');              $('#djDebugToolbarHandle').show();              // set handle position -            var handleTop = $.cookie('djdttop'); +            var handleTop = djdt.cookie.get('djdttop');              if (handleTop) {                  $('#djDebugToolbarHandle').css({top: handleTop + 'px'});              }              // Unbind keydown              $(document).unbind('keydown.djDebug');              if (setCookie) { -                $.cookie('djdt', 'hide', { +                djdt.cookie.set('djdt', 'hide', {                      path: '/',                      expires: 10                  }); @@ -235,7 +235,7 @@              } else {                  $('#djDebugToolbar').show();              } -            $.cookie('djdt', 'show', { +            djdt.cookie.set('djdt', 'show', {                  path: '/',                  expires: 10              }); @@ -246,6 +246,39 @@              } else {                  djdt.events.ready.push(callback);              } +        }, +        cookie: { +            get: function(key){ +                if (document.cookie.indexOf(key) === -1) return null; + +                var cookieArray = document.cookie.split('; '), +                    cookies = {}; + +                cookieArray.forEach(function(e){ +                    var parts = e.split('='); +                    cookies[ parts[0] ] = parts[1]; +                }); + +                return cookies[ key ]; +            }, +            set: function(key, value, options){ +                options = options || {}; + +                if (typeof options.expires === 'number') { +                    var days = options.expires, t = options.expires = new Date(); +                    t.setDate(t.getDate() + days); +                } + +                document.cookie = [ +                    encodeURIComponent(key) + '=' + String(value), +                    options.expires ? '; expires=' + options.expires.toUTCString() : '', +                    options.path    ? '; path=' + options.path : '', +                    options.domain  ? '; domain=' + options.domain : '', +                    options.secure  ? '; secure' : '' +                ].join(''); + +                return value; +            }          }      };      $(document).ready(djdt.init); diff --git a/debug_toolbar/templates/debug_toolbar/base.html b/debug_toolbar/templates/debug_toolbar/base.html index 52ebb57..6ceb735 100644 --- a/debug_toolbar/templates/debug_toolbar/base.html +++ b/debug_toolbar/templates/debug_toolbar/base.html @@ -6,7 +6,6 @@  <script>//<![CDATA[  if(!window.jQuery) document.write('<scr'+'ipt src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></scr'+'ipt>');  //]]></script> -<script src="{% static 'debug_toolbar/js/jquery.cookie.js' %}"></script>  <script src="{% static 'debug_toolbar/js/toolbar.js' %}"></script>  <div id="djDebug" style="display:none;" dir="ltr"       data-store-id="{{ toolbar.store_id }}" data-render-panel-url="{% url 'djdt:render_panel' %}" diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql_explain.html b/debug_toolbar/templates/debug_toolbar/panels/sql_explain.html index 7c85148..da9b120 100644 --- a/debug_toolbar/templates/debug_toolbar/panels/sql_explain.html +++ b/debug_toolbar/templates/debug_toolbar/panels/sql_explain.html @@ -1,4 +1,4 @@ -{% load i18n %} +{% load i18n %}{% load static from staticfiles %}  <div class="djDebugPanelTitle">  	<a class="djDebugClose djDebugBack" href="">{% trans "Back" %}</a>  	<h3>{% trans "SQL explained" %}</h3> @@ -33,3 +33,5 @@  		</table>  	</div>  </div> + +<script src="{% static 'debug_toolbar/js/toolbar.sql.js' %}"></script> diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql_profile.html b/debug_toolbar/templates/debug_toolbar/panels/sql_profile.html index c6676be..af70d92 100644 --- a/debug_toolbar/templates/debug_toolbar/panels/sql_profile.html +++ b/debug_toolbar/templates/debug_toolbar/panels/sql_profile.html @@ -1,4 +1,4 @@ -{% load i18n %} +{% load i18n %}{% load static from staticfiles %}  <div class="djDebugPanelTitle">  	<a class="djDebugClose djDebugBack" href="">{% trans "Back" %}</a>  	<h3>{% trans "SQL profiled" %}</h3> @@ -40,3 +40,5 @@  		{% endif %}  	</div>  </div> + +<script src="{% static 'debug_toolbar/js/toolbar.sql.js' %}"></script> diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql_select.html b/debug_toolbar/templates/debug_toolbar/panels/sql_select.html index 7d587bd..60882d3 100644 --- a/debug_toolbar/templates/debug_toolbar/panels/sql_select.html +++ b/debug_toolbar/templates/debug_toolbar/panels/sql_select.html @@ -1,4 +1,4 @@ -{% load i18n %} +{% load i18n %}{% load static from staticfiles %}  <div class="djDebugPanelTitle">  	<a class="djDebugClose djDebugBack" href="">{% trans "Back" %}</a>  	<h3>{% trans "SQL selected" %}</h3> @@ -37,3 +37,5 @@  		{% endif %}  	</div>  </div> + +<script src="{% static 'debug_toolbar/js/toolbar.sql.js' %}"></script> diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py index 53b3182..03d4b7c 100644 --- a/debug_toolbar/toolbar.py +++ b/debug_toolbar/toolbar.py @@ -6,6 +6,7 @@ from __future__ import absolute_import, unicode_literals  import uuid +import django  from django.conf import settings  from django.conf.urls import patterns, url  from django.core.exceptions import ImproperlyConfigured @@ -66,7 +67,14 @@ class DebugToolbar(object):              context = {'toolbar': self}              return render_to_string('debug_toolbar/base.html', context)          except TemplateSyntaxError: -            if 'django.contrib.staticfiles' not in settings.INSTALLED_APPS: +            if django.VERSION[:2] >= (1, 7): +                from django.apps import apps +                staticfiles_installed = apps.is_installed( +                    'django.contrib.staticfiles') +            else: +                staticfiles_installed = ('django.contrib.staticfiles' +                                         in settings.INSTALLED_APPS) +            if not staticfiles_installed:                  raise ImproperlyConfigured(                      "The debug toolbar requires the staticfiles contrib app. "                      "Add 'django.contrib.staticfiles' to INSTALLED_APPS and " diff --git a/docs/conf.py b/docs/conf.py index f4b07b5..9b2525e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -59,7 +59,7 @@ copyright = u'2013, Django Debug Toolbar developers and contributors'  # The short X.Y version.  version = '1.0'  # The full version, including alpha/beta/rc tags. -release = '1.0' +release = '1.0.1'  # The language for content autogenerated by Sphinx. Refer to documentation  # for a list of supported languages. diff --git a/docs/installation.rst b/docs/installation.rst index f761e91..70ca46e 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -23,12 +23,16 @@ Quick setup  Make sure that ``'django.contrib.staticfiles'`` is `set up properly  <https://docs.djangoproject.com/en/stable/howto/static-files/>`_ and add -``'debug_toolbar'`` to your ``INSTALLED_APPS`` setting:: +``'debug_toolbar.apps.DebugToolbarConfig'`` (Django ≥ 1.7) or +``'debug_toolbar'`` (Django < 1.7) to your ``INSTALLED_APPS`` setting::      INSTALLED_APPS = (          # ...          'django.contrib.staticfiles',          # ... +        # If you're using Django 1.7.x or later +        'debug_toolbar.apps.DebugToolbarConfig', +        # If you're using Django 1.6.x or earlier          'debug_toolbar',      ) @@ -2,7 +2,7 @@ from setuptools import setup, find_packages  setup(      name='django-debug-toolbar', -    version='1.0', +    version='1.0.1',      description='A configurable set of panels that display various debug '                  'information about the current request/response.',      long_description=open('README.rst').read(), diff --git a/tests/commands/test_debugsqlshell.py b/tests/commands/test_debugsqlshell.py index f0c88fa..f10a629 100644 --- a/tests/commands/test_debugsqlshell.py +++ b/tests/commands/test_debugsqlshell.py @@ -4,7 +4,10 @@ import sys  from django.contrib.auth.models import User  from django.core import management -from django.db.backends import util +try: +    from django.db.backends import utils +except ImportError: +    from django.db.backends import util as utils  from django.test import TestCase  from django.test.utils import override_settings  from django.utils import six @@ -14,8 +17,8 @@ from django.utils import six  class DebugSQLShellTestCase(TestCase):      def setUp(self): -        self.original_cursor_wrapper = util.CursorDebugWrapper -        # Since debugsqlshell monkey-patches django.db.backends.util, we can +        self.original_cursor_wrapper = utils.CursorDebugWrapper +        # Since debugsqlshell monkey-patches django.db.backends.utils, we can          # test it simply by loading it, without executing it. But we have to          # undo the monkey-patch on exit.          command_name = 'debugsqlshell' @@ -23,7 +26,7 @@ class DebugSQLShellTestCase(TestCase):          management.load_command_class(app_name, command_name)      def tearDown(self): -        util.CursorDebugWrapper = self.original_cursor_wrapper +        utils.CursorDebugWrapper = self.original_cursor_wrapper      def test_command(self):          original_stdout, sys.stdout = sys.stdout, six.StringIO() diff --git a/tests/panels/test_logging.py b/tests/panels/test_logging.py index 342e673..288efad 100644 --- a/tests/panels/test_logging.py +++ b/tests/panels/test_logging.py @@ -2,7 +2,8 @@ from __future__ import absolute_import, unicode_literals  import logging -from debug_toolbar.panels.logging import MESSAGE_IF_STRING_REPRESENTATION_INVALID +from debug_toolbar.panels.logging import ( +    collector, MESSAGE_IF_STRING_REPRESENTATION_INVALID)  from ..base import BaseTestCase @@ -13,6 +14,7 @@ class LoggingPanelTestCase(BaseTestCase):          super(LoggingPanelTestCase, self).setUp()          self.panel = self.toolbar.get_panel_by_id('LoggingPanel')          self.logger = logging.getLogger(__name__) +        collector.clear_collection()      def test_happy_case(self):          self.logger.info('Nothing to see here, move along!') diff --git a/tests/settings.py b/tests/settings.py index 70049b4..0a4094d 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -40,6 +40,8 @@ MIDDLEWARE_CLASSES = [  ROOT_URLCONF = 'tests.urls' +STATIC_ROOT = os.path.join(BASE_DIR, 'tests', 'static') +  STATIC_URL = '/static/'  STATICFILES_DIRS = [ | 
