diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2013-09-27 21:45:25 -0300 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2013-09-28 17:32:23 -0300 |
| commit | 783620ccc827057d1d0f2c6f4808350be9193bf9 (patch) | |
| tree | 0cc33241b2e584754711c1d952cefe4483d85079 | |
| parent | 47e79bfcfb65c5e7bb4e4402c593ac40def6efb4 (diff) | |
Fixed #21162 -- Better emulation of staticfiles middleware.
Code had been added in e909ceae9b. Solves test suite failures observed
on Windows.
Thanks Michael Manfre for the report. Refs #20739.
| -rw-r--r-- | django/test/testcases.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py index a657530f94..3f0046314e 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -958,7 +958,11 @@ class FSFilesHandler(WSGIHandler): def serve(self, request): os_rel_path = self.file_path(request.path) - final_rel_path = posixpath.normpath(unquote(os_rel_path)).lstrip('/') + os_rel_path = posixpath.normpath(unquote(os_rel_path)) + # Emulate behavior of django.contrib.staticfiles.views.serve() when it + # invokes staticfiles' finders functionality. + # TODO: Modify if/when that internal API is refactored + final_rel_path = os_rel_path.replace('\\', '/').lstrip('/') return serve(request, final_rel_path, document_root=self.get_base_dir()) def __call__(self, environ, start_response): |
