diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-05-07 17:53:23 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-05-07 17:53:23 +0000 |
| commit | a59095af24bb64a025ce99de3555f2a21da7a2e8 (patch) | |
| tree | 7594e9afa256880ff4cfc7f43fed851f4a0f7133 | |
| parent | fb9ac5729d309f6ec59e4089b7ab04378cb9082a (diff) | |
Fixed #11030: fixed file uploads on non-utf8 filesystem encoding. Thanks, Honza Kral.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10693 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/core/files/storage.py | 4 | ||||
| -rw-r--r-- | tests/modeltests/files/models.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/django/core/files/storage.py b/django/core/files/storage.py index bf30a787bb..13acada64a 100644 --- a/django/core/files/storage.py +++ b/django/core/files/storage.py @@ -6,7 +6,7 @@ from django.conf import settings from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation from django.core.files import locks, File from django.core.files.move import file_move_safe -from django.utils.encoding import force_unicode +from django.utils.encoding import force_unicode, smart_str from django.utils.functional import LazyObject from django.utils.importlib import import_module from django.utils.text import get_valid_filename @@ -212,7 +212,7 @@ class FileSystemStorage(Storage): path = safe_join(self.location, name) except ValueError: raise SuspiciousOperation("Attempted access to '%s' denied." % name) - return os.path.normpath(path) + return smart_str(os.path.normpath(path)) def size(self, name): return os.path.getsize(self.path(name)) diff --git a/tests/modeltests/files/models.py b/tests/modeltests/files/models.py index ba3eb99910..30bbdf2841 100644 --- a/tests/modeltests/files/models.py +++ b/tests/modeltests/files/models.py @@ -70,13 +70,13 @@ ValueError: The 'normal' attribute has no file associated with it. [] >>> files.sort() >>> files -[u'default.txt', u'django_test.txt'] +['default.txt', 'django_test.txt'] >>> obj1.save() >>> dirs, files = temp_storage.listdir('tests') >>> files.sort() >>> files -[u'assignment.txt', u'default.txt', u'django_test.txt'] +['assignment.txt', 'default.txt', 'django_test.txt'] # Files can be read in a little at a time, if necessary. |
