This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Factor out common code for d2 commands register, upload and upload_docs
Type: enhancement Stage: resolved
Components: Distutils2 Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: John.Edmonds, Matthew.Iversen, alexis, eric.araujo, python-dev, tarek
Priority: high Keywords: easy, patch

Created on 2011-05-24 16:48 by eric.araujo, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch.diff John.Edmonds, 2011-06-26 01:41 review
Pull Requests
URL Status Linked Edit
PR 12169 open mjpieters, 2019-03-04 19:15
Messages (12)
msg136770 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-24 16:48
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.
msg136782 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2011-05-24 19:08
good idea! want to tackle this ?
msg138045 - (view) Author: John Edmonds (John.Edmonds) Date: 2011-06-10 02:43
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.
msg138087 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-10 15:49
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.
msg138182 - (view) Author: John Edmonds (John.Edmonds) Date: 2011-06-11 19:52
Here is the patch, re-written for the packaging module.
msg139111 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-25 19:57
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 #10510, which asked that HTTP request use CRLF for maximum compatibility.  The current patch does it.
msg139137 - (view) Author: John Edmonds (John.Edmonds) Date: 2011-06-26 01:41
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'.
msg139287 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-27 14:41
Great patch, thanks!  It’s on the top of my commit list.
msg140028 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-07-08 14:28
New changeset c2785ed52ed4 by Éric Araujo in branch 'default':
Factor out code used by packaging commands for HTTP requests (#12169).
http://hg.python.org/cpython/rev/c2785ed52ed4
msg140030 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-07-08 14:34
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!
msg211796 - (view) Author: Matthew Iversen (Matthew.Iversen) Date: 2014-02-21 03:23
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).
msg211820 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-02-21 07:53
> Hi, I'm wondering why this branch was never merged in?

It was, see the comment before with the changeset link.

> AFIAK, it's roundabout here - http://hg.python.org/cpython/log/28e4cd8fd864/Lib/packaging/command/upload.py

I don’t understand what you mean.

> 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).

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!
History
Date User Action Args
2022-04-11 14:57:17adminsetgithub: 56378
2019-03-04 19:15:44mjpieterssetpull_requests: + pull_request12168
2019-03-04 19:15:19mjpieterssetpull_requests: - pull_request12166
2019-03-04 18:06:21mjpieterssetpull_requests: + pull_request12166
2014-02-21 07:53:35eric.araujosetmessages: + msg211820
2014-02-21 03:23:58Matthew.Iversensetnosy: + Matthew.Iversen
messages: + msg211796
2011-10-23 02:14:03eric.araujounlinkissue10510 superseder
2011-07-08 14:34:26eric.araujosetstatus: open -> closed
resolution: fixed
messages: + msg140030

stage: needs patch -> resolved
2011-07-08 14:28:30python-devsetnosy: + python-dev
messages: + msg140028
2011-06-27 14:41:25eric.araujosetpriority: normal -> high

messages: + msg139287
2011-06-27 14:38:42eric.araujosetfiles: - patch.diff
2011-06-27 14:38:39eric.araujosetfiles: - patch.diff
2011-06-26 01:41:22John.Edmondssetfiles: + patch.diff

messages: + msg139137
2011-06-25 19:57:09eric.araujosetmessages: + msg139111
2011-06-25 19:49:47eric.araujolinkissue10510 superseder
2011-06-11 19:52:04John.Edmondssetfiles: + patch.diff

messages: + msg138182
2011-06-10 15:49:46eric.araujosetmessages: + msg138087
2011-06-10 02:43:33John.Edmondssetfiles: + patch.diff

nosy: + John.Edmonds
messages: + msg138045

keywords: + patch
2011-05-26 14:23:47eric.araujosetkeywords: + easy
assignee: tarek -> eric.araujo
stage: patch review -> needs patch
2011-05-24 19:08:01tareksetmessages: + msg136782
2011-05-24 16:48:44eric.araujocreate