Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1637)

Unified Diff: lib/codereview/codereview.py

Issue 6545052: code review 6545052: codereview.py: Fix crash on auth error handling.
Patch Set: diff -r 90c9121e26c3 https://go.googlecode.com/hg/ Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
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: lib/codereview/codereview.py
===================================================================
--- a/lib/codereview/codereview.py
+++ b/lib/codereview/codereview.py
@@ -2742,7 +2742,9 @@
def __init__(self, url, code, msg, headers, args):
urllib2.HTTPError.__init__(self, url, code, msg, headers, None)
self.args = args
- self.reason = args["Error"]
+ # .reason is now a read-only property based on .msg
+ # this means we ignore 'msg', but that seems to work fine.
+ self.msg = args["Error"]
class AbstractRpcServer(object):
@@ -2875,31 +2877,31 @@
try:
auth_token = self._GetAuthToken(credentials[0], credentials[1])
except ClientLoginError, e:
- if e.reason == "BadAuthentication":
+ if e.msg == "BadAuthentication":
print >>sys.stderr, "Invalid username or password."
continue
- if e.reason == "CaptchaRequired":
+ if e.msg == "CaptchaRequired":
print >>sys.stderr, (
"Please go to\n"
"https://www.google.com/accounts/DisplayUnlockCaptcha\n"
"and verify you are a human. Then try again.")
break
- if e.reason == "NotVerified":
+ if e.msg == "NotVerified":
print >>sys.stderr, "Account not verified."
break
- if e.reason == "TermsNotAgreed":
+ if e.msg == "TermsNotAgreed":
print >>sys.stderr, "User has not agreed to TOS."
break
- if e.reason == "AccountDeleted":
+ if e.msg == "AccountDeleted":
print >>sys.stderr, "The user account has been deleted."
break
- if e.reason == "AccountDisabled":
+ if e.msg == "AccountDisabled":
print >>sys.stderr, "The user account has been disabled."
break
- if e.reason == "ServiceDisabled":
+ if e.msg == "ServiceDisabled":
print >>sys.stderr, "The user's access to the service has been disabled."
break
- if e.reason == "ServiceUnavailable":
+ if e.msg == "ServiceUnavailable":
print >>sys.stderr, "The service is not available; try again later."
break
raise
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b