Commit c0707f8e authored by dnj@google.com's avatar dnj@google.com

upload.py: Fix undefined variable bug.

BUG=chromium:356813
TEST=None
R=vadimsh@chromium.org, stip@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294704 0039d316-1c4b-4281-b951-d872f2087c98
parent 491272f1
...@@ -372,32 +372,33 @@ class AbstractRpcServer(object): ...@@ -372,32 +372,33 @@ class AbstractRpcServer(object):
authentication cookie, it returns a 401 response (or a 302) and authentication cookie, it returns a 401 response (or a 302) and
directs us to authenticate ourselves with ClientLogin. directs us to authenticate ourselves with ClientLogin.
""" """
INTERNAL_ERROR_MAP = {
"badauth": "BadAuthentication",
"cr": "CaptchaRequired",
"adel": "AccountDeleted",
"adis": "AccountDisabled",
"sdis": "ServiceDisabled",
"ire": "ServiceUnavailable",
}
for i in range(3): for i in range(3):
credentials = self.auth_function() credentials = self.auth_function()
# Try external, then internal. # Try external, then internal.
e = None e = None
error_map = None
try: try:
auth_token = self._GetAuthToken(credentials[0], credentials[1]) auth_token = self._GetAuthToken(credentials[0], credentials[1])
except urllib2.HTTPError: except urllib2.HTTPError:
try: try:
# Try internal endpoint.
error_map = {
"badauth": "BadAuthentication",
"cr": "CaptchaRequired",
"adel": "AccountDeleted",
"adis": "AccountDisabled",
"sdis": "ServiceDisabled",
"ire": "ServiceUnavailable",
}
auth_token = self._GetAuthToken(credentials[0], credentials[1], auth_token = self._GetAuthToken(credentials[0], credentials[1],
internal=True) internal=True)
except ClientLoginError, exc: except ClientLoginError, exc:
e = exc e = exc
if e: if e:
print >> sys.stderr, '' print >> sys.stderr, ''
if internal: if error_map:
e.reason = INTERNAL_ERROR_MAP.get(e.reason, e.reason) e.reason = error_map.get(e.reason, e.reason)
if e.reason == "BadAuthentication": if e.reason == "BadAuthentication":
if e.info == "InvalidSecondFactor": if e.info == "InvalidSecondFactor":
print >> sys.stderr, ( print >> sys.stderr, (
......
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