Fixed #21219 -- Added a way to set different permission for static files. #1803

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

Owner

Previously, when collecting static files, the files would receive permission
from FILE_UPLOAD_PERMISSIONS. Now, there's an option to give different
permission from uploaded files permission by subclassing any of the static
files storage classes and setting the file_permissions_mode parameter.

Thanks dblack at atlassian.com for the suggestion.

@vajrasky @timgraham vajrasky Fixed #21219 -- Added a way to set different permission for static fi…
…les.

Previously, when collecting static files, the files would receive permission
from FILE_UPLOAD_PERMISSIONS. Now, there's an option to give different
permission from uploaded files permission by subclassing any of the static
files storage classes and setting the file_permissions_mode parameter.

Thanks dblack at atlassian.com for the suggestion.
1a50508
@vajrasky vajrasky commented on the diff Oct 24, 2013
django/core/files/storage.py
@@ -155,6 +155,7 @@ def __init__(self, location=None, base_url=None):
if base_url is None:
base_url = settings.MEDIA_URL
self.base_url = base_url
+ self.file_permissions_mode = file_permissions_mode or settings.FILE_UPLOAD_PERMISSIONS
vajrasky
vajrasky Oct 24, 2013 Contributor

This is not going well if the user tries to give permission 0o000. I know, I know, who is in the sound mind gives permission 0o000 to files. But still.....

timgraham
timgraham Oct 24, 2013 Owner

how about file_permissions_mode if file_permissions_mode is not None else settings.FILE_UPLOAD_PERMISSIONS?

vajrasky
vajrasky Oct 24, 2013 Contributor

It works. But it exceeds 80 characters.

Owner

merged in 9eecb91.

@timgraham timgraham closed this Oct 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment