Commit c7da66a4 authored by tandrii@chromium.org's avatar tandrii@chromium.org

Fix gerrit_util to use non None body.

Gerrit requires Content-Length to be set for POST requests.
httplib Python library has a bug which doesn't set Content-Length
if the body is empty.

Python BUGS:
https://bugs.python.org/issue14721 (partial fix)
https://bugs.python.org/issue23539 (full fix)

The full fix only appears in 2.7.11 release changelog
(technically, it's been fixed in 2.7.10 rc1, but 2.7.10 was not
released):
https://hg.python.org/cpython/raw-file/53d30ab403f1/Misc/NEWS

R=andybons@chromium.org,szager@chromium.org
BUG=579160

Review URL: https://codereview.chromium.org/1827653002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299459 0039d316-1c4b-4281-b951-d872f2087c98
parent ab8b6d25
......@@ -479,7 +479,7 @@ def GetChangeReview(host, change, revision=None):
def AbandonChange(host, change, msg=''):
"""Abandon a gerrit change."""
path = 'changes/%s/abandon' % change
body = {'message': msg} if msg else None
body = {'message': msg} if msg else {}
conn = CreateHttpConn(host, path, reqtype='POST', body=body)
return ReadHttpJsonResponse(conn, ignore_404=False)
......@@ -487,7 +487,7 @@ def AbandonChange(host, change, msg=''):
def RestoreChange(host, change, msg=''):
"""Restore a previously abandoned change."""
path = 'changes/%s/restore' % change
body = {'message': msg} if msg else None
body = {'message': msg} if msg else {}
conn = CreateHttpConn(host, path, reqtype='POST', body=body)
return ReadHttpJsonResponse(conn, ignore_404=False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment