Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent commit to S3BotoStorageMixin forces use of preload_metadata #48

Open
paulcwatts opened this issue Aug 1, 2015 · 4 comments
Open

Comments

@paulcwatts
Copy link

The commit 8d91c77 seems to have an unintended consequence. The entries dictionary is only populated if preload_metadata = True (https://bitbucket.org/david/django-storages/src/f153a70ba254dc129d9403546809a02256ef75b5/storages/backends/s3boto.py?at=default#s3boto.py-302)

If preload_metadata = False (which is the default) then this causes a KeyError when there is anything in the bucket.

It seems instead that this should call self.size rather than using self.entries directly. self.size(name) does everything the recent change does but without requiring preload_metadata = True.

@stephenmcd
Copy link
Owner

I'm not across any of this at all unfortunately, but if you have a fix in mind, it's certainly welcome!

moiseshiraldo added a commit to moiseshiraldo/filebrowser-safe that referenced this issue Feb 12, 2016
@moiseshiraldo
Copy link
Contributor

I've recently deployed a Mezzanine project using AWS and got the same problem, KeyError due to empty entries if the preload_metadata option is disabled (default value). The solution has been perfectly explained by the author of the issue.

@derek-adair
Copy link

This cost me about 8 hours by the way, i couldn't for the life of me figure out why this was failing.

@paulcwatts
Copy link
Author

I'm glad this issue could help at least. I'd submit a PR, but I'm no longer using Mezzanine for any active projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants