diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-08-27 22:21:14 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-08-27 22:21:14 +0000 |
| commit | ff420b43647dd7f149f000efd2c7eb077f6ba5cf (patch) | |
| tree | 5e183421e0d4b78fa607f5b0fd664c3d3b2c7f29 /django | |
| parent | f58217cc02fe6779a69bdf092ce6095bb368401c (diff) | |
Fixed #8454: added a FILE_UPLOAD_PERMISSIONS setting to control the permissoin of files uploaded by the built-in file storage system. Thanks, dcwatson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8640 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/conf/global_settings.py | 4 | ||||
| -rw-r--r-- | django/core/files/storage.py | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 2c48571787..33d8e5f7a3 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -252,6 +252,10 @@ FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440 # i.e. 2.5 MB # (i.e. "/tmp" on *nix systems). FILE_UPLOAD_TEMP_DIR = None +# The numeric mode to set newly-uploaded files to. The value should be a mode +# you'd pass directly to os.chmod; see http://docs.python.org/lib/os-file-dir.html. +FILE_UPLOAD_PERMISSIONS = None + # Default formatting for date objects. See all available format strings here: # http://www.djangoproject.com/documentation/templates/#now DATE_FORMAT = 'N j, Y' diff --git a/django/core/files/storage.py b/django/core/files/storage.py index a320b8e447..8451485915 100644 --- a/django/core/files/storage.py +++ b/django/core/files/storage.py @@ -172,7 +172,10 @@ class FileSystemStorage(Storage): else: # 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) + return name def delete(self, name): |
