This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
Python 2/3 Support #22
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
692bd16
Python 2/3 support for command line input
archen fde7285
Python 2/3 support for md5 path encoding
archen 81afa67
added comments for better identification of proposed changes
archen 3420973
Update setup.py
archen 5cd3965
Removed environment specific ignores.
archen 4e8aaad
Update setup.py
archen 6c7d9ca
changed input function import to match the style used by core Django.…
archen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is copied straight from Django itself so I'd rather maintain it being as similar as possible to Django. I am not sure what the differences between raw_input and input are though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The big difference is raw_input doesn't exist in Python 3.x. Which Django module did you pull this code from? I'd be interested in seeing how they handle this issue for Py2/3 compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's from here: https://github.com/django/django/blob/stable/1.4.x/django/contrib/staticfiles/management/commands/collectstatic.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to update the code so that it reflects the latest stable version of Django, I'd be fine with that. Alternatively, if you'd be able to modify the output in a cleaner way without duplicating all the code, that'd be preferable ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you say modify the output, you mean try to find a way to override the output message in the function provided by Django 1.6+'s collectstatic?
It looks like they import 'input' from the included six utility in Django 1.6. If I can't figure out the DRYest way of doing it, I'll just remove the logic up top that looks for the built-in and use the six module instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what I meant.
Cool, just make sure it's compatible with 1.4.x as well 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason that you're declaring this function anyway? I don't see anything collectfast specific happening in handle_noargs. Why override at all?
edit: I removed handle_noargs entirely from a local branch and collectstatic still behaves as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To output the number of skipped files: https://github.com/antonagestam/collectfast/blob/master/collectfast/management/commands/collectstatic.py#L142
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I missed that line in the template. I can't think of a better way at this point to override only the template and summary due to the order of execution. For now, I'll wrap testing on Django 1.4+ and Python 2/3 and push the changes for the input call still overriding handle_noargs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing done. All is well in my environment with Python 2/3 and Django 1.4 - 1.7 using S3 and boto with collectfast.