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
Factor out common code for d2 commands register, upload and upload_docs #56378
Comments
These three commands have different code to do POST requests, using rllib or httplib. This already made us do more work to fix bugs and to port the code. upload_docs has a top-level function for multipart encoding; this should be moved to a common module, cleaned up and used by all our code that needs a POST. |
good idea! want to tackle this ? |
I'd like to try tackling this issue. I've made a patch that moves encode_multipart from upload_docs to the distutils2.command module and changed the register and upload commands to use this function. |
Thanks for your contribution. Unfortunately, I used “distutils2” as a familiar name for what is now known as the packaging module, in the 3.3 standard library. This document should help you find the right codebase to work from: http://wiki.python.org/moin/Distutils/Contributing Regarding the new location of the moved code, I think the util module would be a better choice than command. |
Here is the patch, re-written for the packaging module. |
I made some comments on the code review site; maybe you didn’t get the email, there is a known bug about that. You can follow the “review” link on the right of the patch file to see it. I have closed bpo-10510, which asked that HTTP request use CRLF for maximum compatibility. The current patch does it. |
Thanks for reviewing the patch. I don't believe I received an email for the review. I think I have addressed your comment about the usage of str(body) by removing the call to str() and changing the tests to use byte literals. As for the content-length changing in the tests, that is because encode_multipart uses '\r\n' to end lines while the previous code only ended lines in '\n'. |
Great patch, thanks! It’s on the top of my commit list. |
New changeset c2785ed52ed4 by Éric Araujo in branch 'default': |
I added a few blank lines, changed the error message when boundary is not bytes, moved test_encode_multipart to test_util.py and committed. Thanks again! |
Hi, I'm wondering why this branch was never merged in? AFIAK, it's roundabout here - http://hg.python.org/cpython/log/28e4cd8fd864/Lib/packaging/command/upload.py It'd be great to have distutils submit forms that are compliant with the MIME spec (in my use case, cherrypy completely borks on it). |
It was, see the comment before with the changeset link.
I don’t understand what you mean.
This issue was about distutils2/packaging, a project which is now abandoned. If a distutils command has a bug with HTTP POSTs, please file another ticket and I’ll have a look. Thanks in advance! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: