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

skirsdeda
Copy link
Contributor

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
Copy link
Contributor Author

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:]
Copy link
Owner

Choose a reason for hiding this comment

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

let's you str instead of repr here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

@jschneier
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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

jschneier added a commit that referenced this pull request Feb 12, 2015
Fix exists and add modified_time in FTP storage
@jschneier jschneier merged commit 8642018 into jschneier:master Feb 12, 2015
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.

2 participants