diff options
| author | Jannis Leidel <jannis@leidel.info> | 2010-12-31 14:22:32 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2010-12-31 14:22:32 +0000 |
| commit | 0de63c96f2a230d8e768ea876b6eb4bc3c8f80dd (patch) | |
| tree | 32fecd41b5bb497a911d5b96e4981c5f448a6096 /django | |
| parent | f2c4c63cdccd4883d3da8cfb9ff3bcd78406210d (diff) | |
Fixed #14961 -- Revised staticfiles's prefix handling to make sure it runs on Windows. Also revised staticfiles tests to pass on Windows.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15119 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/staticfiles/finders.py | 4 | ||||
| -rw-r--r-- | django/contrib/staticfiles/views.py | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/django/contrib/staticfiles/finders.py b/django/contrib/staticfiles/finders.py index ca0a248a39..a43412c499 100644 --- a/django/contrib/staticfiles/finders.py +++ b/django/contrib/staticfiles/finders.py @@ -79,7 +79,7 @@ class FileSystemFinder(BaseFinder): absolute path (or ``None`` if no match). """ if prefix: - prefix = '%s/' % prefix + prefix = '%s%s' % (prefix, os.sep) if not path.startswith(prefix): return None path = path[len(prefix):] @@ -144,7 +144,7 @@ class AppDirectoriesFinder(BaseFinder): storage = self.storages[app] prefix = storage.get_prefix() if prefix: - prefix = '%s/' % prefix + prefix = '%s%s' % (prefix, os.sep) if not path.startswith(prefix): return None path = path[len(prefix):] diff --git a/django/contrib/staticfiles/views.py b/django/contrib/staticfiles/views.py index 694591c996..f5a6ec3dae 100644 --- a/django/contrib/staticfiles/views.py +++ b/django/contrib/staticfiles/views.py @@ -47,6 +47,7 @@ def serve(request, path, document_root=None, show_indexes=False, insecure=False) "the --insecure option of 'runserver' is " "used") if not document_root: + path = os.path.normpath(path) absolute_path = finders.find(path) if not absolute_path: raise Http404('"%s" could not be found' % path) |
