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

Update "seek of closed file" fix for current django-storages #6

Merged
merged 1 commit into from Jul 17, 2020

Conversation

nikolas
Copy link
Member

@nikolas nikolas commented Jul 16, 2020

Using this class with the new django-storages gives the error:

ValueError: seek of closed file

This change should fix that -
jschneier/django-storages#382 (comment)

Using this class with the new django-storages gives the error:

  ValueError: seek of closed file

This change should fix that -
jschneier/django-storages#382 (comment)
# Fix for "ValueError: seek of closed file" problem with boto3
# https://github.com/jschneier/django-storages/issues/382#issuecomment-377174808
def _save_content(self, obj, content, parameters):
# https://github.com/jschneier/django-storages/issues/382
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is removed completely, will it just pick up the one in django-storages?

Copy link
Member Author

@nikolas nikolas Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmmm, good point.. maybe the fix is already in I may be getting confused. Let me see if I can reproduce this locally with ./manage.py compress to test that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so when testing this locally (actually with ./manage.py collectstatic):

When I remove the _save/_save_content override completely, I get the same error:

  File "/home/nik/src/d/mediathread/ve/lib64/python3.7/site-packages/django/core/files/base.py", line 55, in chunks
    self.seek(0)
ValueError: seek of closed file

With this change.... well it's still running and not showing any output yet. I'll see what happens, but looks promising.

Copy link
Member Author

@nikolas nikolas Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, yes. It's actually copying the files successfully with this override (when you do ./manage.py collectstatic -v 3)... which unfortunately still seems necessary.

@sdreher sdreher merged commit 8bb172f into master Jul 17, 2020
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 this pull request may close these issues.

None yet

2 participants