chipx86 got a fish trophy!
Update post-review to work with the Review Board 1.5 API.
Review Request #2002 — Created Dec. 14, 2010 and submitted
Update post-review to work with the Review Board 1.5 API. This updates post-review to use the new API in Review Board 1.5 when available. The deprecated API won't be used in this case. However, if the new API is not available, we fall back on the deprecated API in order to continue supporting older installations. This will require some fixes/enhancements to the API that are going in to 1.5.2. The API checks will be updated to check for the version once that release has been done. This has feature parity with the old API.
Posted several review requests, updated diffs, set various fields, published, and reopened review requests. Verified that cookies were being successfully loaded and saved. Making a subsequent call to post-review didn't require a re-login. Using --username by itself prompted for a password and then tried to make use of that password. When I gave it valid credentials, the request went through. When I continued to give it bogus credentials, it kept re-asking, and eventually failed, just like it used to. Providing both --username= and --password= on the command line caused it to successfully log in. Tested that updating review requests works on older Python versions. Tested that --submit-as continues to work fine.
- Change Summary:
-
* Updated to support --username= and --password=. We now pre-set the authorization header when these are specified, using the new PresetHTTPAuthHandler. * Now prompts only for a password if --username= is specified and --password= is not. * Cookies are now loaded on initialization instead of on old-style login, allowing them to work with the new API for any request. * Python no longer goes into an infinite loop of retries on unsuccessful login. We use a new ReviewBoardHTTPBasicAuthHandler class that doesn't blindly retry, but instead retries once and then fails, so that our existing retry code can properly handle re-requesting credentials. * Replaced the built-in HTTPErrorProcessor with a custom ReviewBoardHTTPErrorProcessor, which fixes support for HTTP status codes in the 200 range on Python 2.4 and 2.5. On these versions, only 200 and 206 were considered success codes.
- Description:
-
Update post-review to work with the Review Board 1.5 API.
This updates post-review to use the new API in Review Board 1.5 when
available. The deprecated API won't be used in this case. However, if the new API is not available, we fall back on the deprecated API in order to continue supporting older installations. This will require some fixes/enhancements to the API that are going in to
1.5.2. The API checks will be updated to check for the version once that release has been done. ~ There are some known regressions/changes in how authentication works, which
~ This has feature parity with the old API.
- I need to investigate. This is due to the move to Basic HTTP Auth instead of - a login URL. We respond with a username/password when requested, but if the - user wants to specify different credentials, they're stuck. This means that - --username and --password are currently busted. - - Also, loading from cookies appears busted as well. I'll be working on fixes
- for these issues. - Testing Done:
-
Posted several review requests, updated diffs, set various fields, published,
and reopened review requests. ~ The only API path I wasn't able to test was the changenum path, since we don't
~ have test infrastructure for that. ~ Verified that cookies were being successfully loaded and saved. Making a subsequent
~ call to post-review didn't require a re-login. ~ I posted the first version of this review request with this new post-review.
~ However, due to some bugs in the API (fixes for which are being posted separately) ~ I wasn't able to update the review request with this version. Once the fixes are ~ in, that will work just fine. ~ Using --username by itself prompted for a password and then tried to make use of that
~ password. When I gave it valid credentials, the request went through. When I continued ~ to give it bogus credentials, it kept re-asking, and eventually failed, just like it ~ used to. + + Providing both --username= and --password= on the command line caused it to successfully
+ log in. + + Tested that updating review requests works on older Python versions.
- Diff:
-
Revision 2 (+343 -56)
- Testing Done:
-
Posted several review requests, updated diffs, set various fields, published,
and reopened review requests. Verified that cookies were being successfully loaded and saved. Making a subsequent
call to post-review didn't require a re-login. Using --username by itself prompted for a password and then tried to make use of that
password. When I gave it valid credentials, the request went through. When I continued to give it bogus credentials, it kept re-asking, and eventually failed, just like it used to. Providing both --username= and --password= on the command line caused it to successfully
log in. Tested that updating review requests works on older Python versions.
+ + Tested that --submit-as continues to work fine.