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

Fix exists and add modified_time in FTP storage #26

Merged
merged 5 commits into from Feb 12, 2015

Conversation

Projects
None yet
2 participants
@skirsdeda
Copy link
Contributor

skirsdeda commented Feb 9, 2015

Apparently various FTP servers are inconsistent in NLST command output. Some output only filenames, others output paths. This fix supports both.

@skirsdeda skirsdeda changed the title Fix exists in FTP storage Fix exists and add modified_time in FTP storage Feb 9, 2015

@skirsdeda

This comment has been minimized.

Copy link
Contributor Author

skirsdeda commented Feb 9, 2015

Also added modified_time function

# workaround for broken FTP servers returning responses
# starting with e.g. 1904... instead of 2004...
if len(s) == 15 and s[:2] == '19':
s = repr(1900 + int(s[2:5])) + s[5:]

This comment has been minimized.

Copy link
@jschneier

jschneier Feb 10, 2015

Owner

let's you str instead of repr here.

This comment has been minimized.

Copy link
@skirsdeda

skirsdeda Feb 10, 2015

Author Contributor

Yeah, str would probably be a better option. I copied this from some path to python's ftplib which was never accepted.

@@ -236,7 +252,6 @@ def read(self, num_bytes=None):
if not self._is_read:
self._storage._start_connection()
self.file = self._storage._read(self._name)
self._storage._end_connection()

This comment has been minimized.

Copy link
@jschneier

jschneier Feb 10, 2015

Owner

what was the logic of removing this?

This comment has been minimized.

Copy link
@skirsdeda

skirsdeda Feb 10, 2015

Author Contributor

function _end_connection() doesn't exist. With current code read() doesn't work at all because of this.

This comment has been minimized.

Copy link
@jschneier

jschneier Feb 10, 2015

Owner

of course.

@jschneier

This comment has been minimized.

Copy link
Owner

jschneier commented Feb 10, 2015

Hi and thanks for your contribution. I'm excited that someone is using the FTP backend of this library. I've left a few comments inline and I'd be happy to merge this after they are addressed.

@skirsdeda

This comment has been minimized.

Copy link
Contributor Author

skirsdeda commented Feb 10, 2015

I'm actually using S3, SFTP and FTP. Was using some fork of django-storages-py3 but it's so messed up. Good that I finally found your repo. I'll send some improvements to SFTP backend as well when I get to it.

@skirsdeda

This comment has been minimized.

Copy link
Contributor Author

skirsdeda commented Feb 10, 2015

Changed repr() to str(). Should be good to pull now.

jschneier added a commit that referenced this pull request Feb 12, 2015

Merge pull request #26 from skirsdeda/master
Fix exists and add modified_time in FTP storage

@jschneier jschneier merged commit 8642018 into jschneier:master Feb 12, 2015

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@pyup-bot pyup-bot referenced this pull request Jul 27, 2016

Merged

Initial Update #344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.