Comment #4 on issue 2121 by chris.cl...@actian.com: post-review doesn't handle bad passwords nicely
http://code.google.com/p/reviewboard/issues/detail?id=2121

This is the hack I'm using for older python machines:

    diff --git a/rbtools/postreview.py b/rbtools/postreview.py
    index df791aa..d8af51c 100755
    --- a/rbtools/postreview.py
    +++ b/rbtools/postreview.py
    @@ -12,6 +12,11 @@ from optparse import OptionParser
     import datetime

     try:
    +    from cStringIO import StringIO as FakeFile
    +except ImportError:
    +    from StringIO import StringIO as FakeFile
    +
    +try:
         # setuptools from http://peak.telecommunity.com/
         from pkg_resources import parse_version
     except ImportError:
@@ -192,8 +197,18 @@ class ReviewBoardHTTPBasicAuthHandler(urllib2.HTTPBasicAuthHandler):
             if not self._retried:
                 self._retried = True
                 self.retried = 0
- response = urllib2.HTTPBasicAuthHandler.retry_http_basic_auth(
    -                self, *args, **kwargs)
    +            try:
+ response = urllib2.HTTPBasicAuthHandler.retry_http_basic_auth(
    +                    self, *args, **kwargs)
    +            except ValueError, e:
+ if e.args[0] == "AbstractDigestAuthHandler doesn't know about Basic" and sys.version_info >= (2, 4) and sys.version_info < (2, 5): + # Python 2.4 client and user gave bad username/password
    +                    # Hack to log a slightly more useful error message
+ # See http://code.google.com/p/reviewboard/issues/detail?id=2121 + print 'ERROR: Suspect incorrect username and/or password'
    +                    fileptr = FakeFile('')
+ raise urllib2.HTTPError(None, 401, None, None, fileptr)
    +                raise

                 if response.code != 401:
                     self._retried = False


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard-issues+unsubscr...@googlegroups.com.
To post to this group, send email to reviewboard-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/reviewboard-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to