diff options
| -rw-r--r-- | debug_toolbar/locale/en/LC_MESSAGES/django.po | 7 | ||||
| -rw-r--r-- | debug_toolbar/panels/staticfiles.py | 7 | ||||
| -rw-r--r-- | debug_toolbar/templates/debug_toolbar/panels/staticfiles.html | 4 | ||||
| -rw-r--r-- | tests/panels/test_staticfiles.py | 6 | ||||
| -rw-r--r-- | tests/settings.py | 6 |
5 files changed, 20 insertions, 10 deletions
diff --git a/debug_toolbar/locale/en/LC_MESSAGES/django.po b/debug_toolbar/locale/en/LC_MESSAGES/django.po index 6102d0d..06237f7 100644 --- a/debug_toolbar/locale/en/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/en/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Django Debug Toolbar\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" "PO-Revision-Date: 2012-03-31 20:10+0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -557,6 +557,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/panels/staticfiles.py b/debug_toolbar/panels/staticfiles.py index f212f2b..efaf841 100644 --- a/debug_toolbar/panels/staticfiles.py +++ b/debug_toolbar/panels/staticfiles.py @@ -163,8 +163,11 @@ class StaticFilesPanel(panels.Panel): """ Returns a list of paths to inspect for additional static files """ - dirs = getattr(settings, 'STATICFILES_DIRS', ()) - return [normpath(d) for d in dirs] + dirs = [] + for finder in finders.get_finders(): + if isinstance(finder, finders.FileSystemFinder): + dirs.extend(finder.locations) + return [(prefix, normpath(dir)) for prefix, dir in dirs] def get_staticfiles_apps(self): """ diff --git a/debug_toolbar/templates/debug_toolbar/panels/staticfiles.html b/debug_toolbar/templates/debug_toolbar/panels/staticfiles.html index eb413b5..95c9ec8 100644 --- a/debug_toolbar/templates/debug_toolbar/panels/staticfiles.html +++ b/debug_toolbar/templates/debug_toolbar/panels/staticfiles.html @@ -4,8 +4,8 @@ <h4>{% blocktrans count staticfiles_dirs|length as dirs_count %}Static file path{% plural %}Static file paths{% endblocktrans %}</h4> {% if staticfiles_dirs %} <ol> - {% for staticfiles_dir in staticfiles_dirs %} - <li>{{ staticfiles_dir }}</li> + {% for prefix, staticfiles_dir in staticfiles_dirs %} + <li>{{ staticfiles_dir }}{% if prefix %} {% blocktrans %}(prefix {{ prefix }}){% endblocktrans %}{% endif %}</li> {% endfor %} </ol> {% else %} diff --git a/tests/panels/test_staticfiles.py b/tests/panels/test_staticfiles.py index 70a7b96..be4f267 100644 --- a/tests/panels/test_staticfiles.py +++ b/tests/panels/test_staticfiles.py @@ -2,7 +2,7 @@ from __future__ import absolute_import, unicode_literals -from django.conf import settings +from django.contrib.staticfiles import finders from ..base import BaseTestCase @@ -19,10 +19,10 @@ class StaticFilesPanelTestCase(BaseTestCase): self.assertIn('django.contrib.staticfiles.finders.' 'AppDirectoriesFinder', self.panel.content) self.assertIn('django.contrib.staticfiles.finders.' - 'FileSystemFinder (1 file)', self.panel.content) + 'FileSystemFinder (2 files)', self.panel.content) self.assertEqual(self.panel.num_used, 0) self.assertNotEqual(self.panel.num_found, 0) self.assertEqual(self.panel.get_staticfiles_apps(), ['django.contrib.admin', 'debug_toolbar']) self.assertEqual(self.panel.get_staticfiles_dirs(), - settings.STATICFILES_DIRS) + finders.FileSystemFinder().locations) diff --git a/tests/settings.py b/tests/settings.py index 68346ff..70049b4 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -42,8 +42,10 @@ ROOT_URLCONF = 'tests.urls' STATIC_URL = '/static/' -STATICFILES_DIRS = [os.path.join(BASE_DIR, 'tests', 'additional_static')] - +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, 'tests', 'additional_static'), + ("prefix", os.path.join(BASE_DIR, 'tests', 'additional_static')), +] # Cache and database |
