Ticket #11030: 11030-against-trunk-10686.diff

File 11030-against-trunk-10686.diff, 1.8 KB (added by Honza Král, 15 years ago)
  • django/core/files/storage.py

    commit 3d713c4a32b5938651534ff4832c5afe776f14f4
    Author: Honza Kral <Honza.Kral@gmail.com>
    Date:   Thu May 7 12:36:37 2009 +0200
    
        Fixed some failing tests for files with encoding
    
    diff --git a/django/core/files/storage.py b/django/core/files/storage.py
    index bf30a78..13acada 100644
    a b from django.conf import settings  
    66from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation
    77from django.core.files import locks, File
    88from django.core.files.move import file_move_safe
    9 from django.utils.encoding import force_unicode
     9from django.utils.encoding import force_unicode, smart_str
    1010from django.utils.functional import LazyObject
    1111from django.utils.importlib import import_module
    1212from django.utils.text import get_valid_filename
    class FileSystemStorage(Storage):  
    212212            path = safe_join(self.location, name)
    213213        except ValueError:
    214214            raise SuspiciousOperation("Attempted access to '%s' denied." % name)
    215         return os.path.normpath(path)
     215        return smart_str(os.path.normpath(path))
    216216
    217217    def size(self, name):
    218218        return os.path.getsize(self.path(name))
  • tests/modeltests/files/models.py

    diff --git a/tests/modeltests/files/models.py b/tests/modeltests/files/models.py
    index ba3eb99..30bbdf2 100644
    a b ValueError: The 'normal' attribute has no file associated with it.  
    7070[]
    7171>>> files.sort()
    7272>>> files
    73 [u'default.txt', u'django_test.txt']
     73['default.txt', 'django_test.txt']
    7474
    7575>>> obj1.save()
    7676>>> dirs, files = temp_storage.listdir('tests')
    7777>>> files.sort()
    7878>>> files
    79 [u'assignment.txt', u'default.txt', u'django_test.txt']
     79['assignment.txt', 'default.txt', 'django_test.txt']
    8080
    8181# Files can be read in a little at a time, if necessary.
    8282
Back to Top