summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/core/files/storage.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/django/core/files/storage.py b/django/core/files/storage.py
index b42981cb5e..b05f3647c0 100644
--- a/django/core/files/storage.py
+++ b/django/core/files/storage.py
@@ -147,7 +147,7 @@ class FileSystemStorage(Storage):
Standard filesystem storage
"""
- def __init__(self, location=None, base_url=None):
+ def __init__(self, location=None, base_url=None, file_permissions_mode=None):
if location is None:
location = settings.MEDIA_ROOT
self.base_location = location
@@ -155,6 +155,10 @@ class FileSystemStorage(Storage):
if base_url is None:
base_url = settings.MEDIA_URL
self.base_url = base_url
+ self.file_permissions_mode = (
+ file_permissions_mode if file_permissions_mode is not None
+ else settings.FILE_UPLOAD_PERMISSIONS
+ )
def _open(self, name, mode='rb'):
return File(open(self.path(name), mode))
@@ -232,8 +236,8 @@ class FileSystemStorage(Storage):
# OK, the file save worked. Break out of the loop.
break
- if settings.FILE_UPLOAD_PERMISSIONS is not None:
- os.chmod(full_path, settings.FILE_UPLOAD_PERMISSIONS)
+ if self.file_permissions_mode is not None:
+ os.chmod(full_path, self.file_permissions_mode)
return name