Enable anonymous apply_issue behavior by default and only fall back to login when needed.

Patch in upload.py fix for python 2.7.

TBR=rogerta@chromium.org
BUG=


Review URL: https://chromiumcodereview.appspot.com/10914068

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@154696 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
maruel@chromium.org 13 years ago
parent 9dbbe54f8f
commit 3bf4b3c864

@ -28,7 +28,7 @@ def main():
parser.add_option(
'-e',
'--email',
help='Email address for authenticating with Rietveld')
help='IGNORED: Kept for compatibility.')
parser.add_option(
'-i', '--issue', type='int', help='Rietveld issue number')
parser.add_option(
@ -56,15 +56,16 @@ def main():
if not options.server:
parser.error('Require a valid server')
# TODO(rogerta): Remove me, it's ugly.
if options.email == '=':
options.email = ''
obj = rietveld.Rietveld(options.server, options.email, None)
obj = rietveld.Rietveld(options.server, '', None)
try:
properties = obj.get_issue_properties(options.issue, False)
except rietveld.upload.ClientLoginError:
# Requires login.
obj = rietveld.Rietveld(options.server, None, None)
properties = obj.get_issue_properties(options.issue, False)
if not options.patchset:
options.patchset = obj.get_issue_properties(
options.issue, False)['patchsets'][-1]
options.patchset = properties['patchsets'][-1]
print('No patchset specified. Using patchset %d' % options.patchset)
print('Downloading the patch.')

@ -46,12 +46,11 @@ class Rietveld(object):
get_creds,
extra_headers=extra_headers or {})
else:
self.rpc_server = upload.GetRpcServer(url, email)
# If email is given as an empty string, then assume we want to make
# requests that do not need authentication. Bypass authentication by
# setting the flag to True.
if email == '':
self.rpc_server.authenticated = True
get_creds = lambda: (email, None)
self.rpc_server = upload.HttpRpcServer(url, get_creds)
else:
self.rpc_server = upload.GetRpcServer(url, email)
self._xsrf_token = None
self._xsrf_token_time = None

@ -165,7 +165,6 @@ class ClientLoginError(urllib2.HTTPError):
def __init__(self, url, code, msg, headers, args):
urllib2.HTTPError.__init__(self, url, code, msg, headers, None)
self.args = args
self.reason = args["Error"]
self.info = args.get("Info", None)

Loading…
Cancel
Save