Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: third_party/upload.py

Issue 1060633003: upload.py: Fix undefined variable bug. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/upload.py
diff --git a/third_party/upload.py b/third_party/upload.py
index c9a45b59063b401c31d07a3f42923be2fcb0db9c..1101f26b069b8972459ba3e40cfc93149955c55c 100755
--- a/third_party/upload.py
+++ b/third_party/upload.py
@@ -372,32 +372,33 @@ class AbstractRpcServer(object):
authentication cookie, it returns a 401 response (or a 302) and
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):
credentials = self.auth_function()
# Try external, then internal.
e = None
+ error_map = None
try:
auth_token = self._GetAuthToken(credentials[0], credentials[1])
except urllib2.HTTPError:
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],
internal=True)
except ClientLoginError, exc:
e = exc
if e:
print >> sys.stderr, ''
- if internal:
- e.reason = INTERNAL_ERROR_MAP.get(e.reason, e.reason)
+ if error_map:
+ e.reason = error_map.get(e.reason, e.reason)
if e.reason == "BadAuthentication":
if e.info == "InvalidSecondFactor":
print >> sys.stderr, (
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698