From 0de63c96f2a230d8e768ea876b6eb4bc3c8f80dd Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 31 Dec 2010 14:22:32 +0000 Subject: 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 --- django/contrib/staticfiles/finders.py | 4 ++-- django/contrib/staticfiles/views.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'django') 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) -- cgit v1.3