Ticket #14681: django_mode_patch.diff
File django_mode_patch.diff, 1.1 KB (added by , 14 years ago) |
---|
-
django/core/files/base.py
15 15 if name is None: 16 16 name = getattr(file, 'name', None) 17 17 self.name = name 18 self.mode = getattr(file, 'mode', None) 18 if hasattr(file, 'mode'): 19 self.mode = getattr(file, 'mode') 19 20 20 21 def __str__(self): 21 22 return smart_str(self.name or '') -
tests/modeltests/files/tests.py
92 92 obj4.random.save("random_file", ContentFile("random content")) 93 93 self.assertTrue(obj4.random.name.endswith("/random_file")) 94 94 95 # should not set mode to None if it is not present 96 file = SimpleUploadedFile("mode_test.txt", "content") 97 self.assertFalse(hasattr(file, 'mode')) 98 95 99 # Clean up the temporary files and dir. 96 100 obj1.normal.delete() 97 101 obj2.normal.delete()