1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #14681 -- Do not set mode to None on file-like objects.

gzip.GzipFile does not support files with mode set to None.
This commit is contained in:
Claude Paroz
2012-05-31 09:59:58 +02:00
parent 4b28ea37e5
commit 2626ea4a74
2 changed files with 14 additions and 2 deletions

View File

@@ -12,7 +12,8 @@ class File(FileProxyMixin):
if name is None:
name = getattr(file, 'name', None)
self.name = name
self.mode = getattr(file, 'mode', None)
if hasattr(file, 'mode'):
self.mode = file.mode
def __str__(self):
return smart_str(self.name or '')