flask-s3
flask-s3 copied to clipboard
Optimization
If bucket already exist and contains thousands static files https://github.com/e-dard/flask-s3/blob/master/flask_s3.py#L188
bucket.make_public(recursive=True)
it's very bad idea...
Hmmm, a good point.
I don't have a lot of time right now but I guess a solution could involves using get_all_buckets()
and checking for the bucket
in question. Details here
i'm working on it just now.
I'm not entirely sure that simply changing recursive=False
as suggested in the PR will do the trick. If a bucket already exists, it is likely that you'd want to make the entire thing public. @e-dard, if we checked get_all_buckets()
, would be not make it public recursively? Whatever we do, there should be something added to the documentation to explain that a user needs to make the existing stuff public.
I'm also not entirely sure why that section is in that try/except
block. @e-dard maybe you can enlighten my, but effectively we are now ignoring all but 1 specific error. That's probably a bad idea, and if we are just going to raise that error anyways, why not remove the try/except
entirely?
- Recursive mode 1.1 If we creat new bucket then it's empty and there is no need to do make_public in recursive mode. 1.2 If target bucket already exists then with high probability it’s already public. And all static files makes public when it copied, see https://github.com/e-dard/flask-s3/blob/master/flask_s3.py#L113
- Try/except block In master branch is the same implementation. See https://github.com/e-dard/flask-s3/blob/master/flask_s3.py#L186
- It could be the case that there are files in S3 that aren't copied, but this is an edge case. I still think we should document it.
- Yes, but your change brought it to my attention. ;) Sent from my Nintendo 64
On Thu, Jan 30, 2014 at 5:57 PM, Mike [email protected] wrote:
- Recursive mode 1.1 If we creat new bucket then it's empty and there is no need to do make_public in recursive mode. 1.2 If target bucket already exists then with high probability it’s already public. And all static files makes public when it copied, see https://github.com/e-dard/flask-s3/blob/master/flask_s3.py#L113
Try/except block In master branch is the same implementation. See https://github.com/e-dard/flask-s3/blob/master/flask_s3.py#L186
Reply to this email directly or view it on GitHub: https://github.com/e-dard/flask-s3/issues/16#issuecomment-33744126
Yeah, oops on the try
block :blush: