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

sftp.SFTPStorageFile doesn't properly call it's parent __init__ #487

Closed
lakinwecker opened this issue Apr 18, 2018 · 4 comments
Closed

sftp.SFTPStorageFile doesn't properly call it's parent __init__ #487

lakinwecker opened this issue Apr 18, 2018 · 4 comments

Comments

@lakinwecker
Copy link

Django's file object assumes it has a .name attribute, like in the __bool__ method here: https://github.com/django/django/blob/1.11.12/django/core/files/base.py#L31-L32

It does so, because it sets this attribute in its constructor here: https://github.com/django/django/blob/1.11.12/django/core/files/base.py#L19-L21

However, the sftp.SFTPStorageFile object does not call that constructor: https://github.com/django/django/blob/1.11.12/django/core/files/base.py#L19-L21

Simply adding in super(SFTPStorageFile, self).__init__(file=self.file, name=self._name) at the end of that method solves the issue. I'm not setup to make a PR at the moment, or this would also include a PR. I'm happy to make one later today.

@abeelen
Copy link

abeelen commented Jun 12, 2018

I came across the same issue, and found basically the same solution fiddling around the __init__. It seems that you fixed much more with #489 ! Any chance to get it passing the unit tests ?

@lakinwecker
Copy link
Author

I would love to, but I haven't had the time to get them setup and running locally. :(

@jschneier
Copy link
Owner

I have opened the rebased version at #558 to play with the tests, sorry for the delay.

@jschneier
Copy link
Owner

Sorry inadvertently closed this one.

@jschneier jschneier reopened this Aug 26, 2018
jschneier added a commit that referenced this issue Aug 26, 2018
jschneier added a commit that referenced this issue Aug 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants