Merge lp:~elachuni/ubuntu-recommender/client-uuid-recommend-me into lp:~canonical-ca-hackers/ubuntu-recommender/ubuntu-recommender-client
Status: | Merged |
---|---|
Approved by: | Łukasz Czyżykowski |
Approved revision: | 6 |
Merged at revision: | 6 |
Proposed branch: | lp:~elachuni/ubuntu-recommender/client-uuid-recommend-me |
Merge into: | lp:~canonical-ca-hackers/ubuntu-recommender/ubuntu-recommender-client |
Diff against target: |
21 lines (+9/-2) 1 file modified
sreclient.py (+9/-2) |
To merge this branch: | bzr merge lp:~elachuni/ubuntu-recommender/client-uuid-recommend-me |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Łukasz Czyżykowski (community) | Approve | ||
Review via email: mp+99812@code.launchpad.net |
Description of the change
One way of providing a version of recommend_me that only requires a uuid. I could think of two other alternatives for this:
- A single method with an "authenticated" bool argument, but if you (the caller) would need to have instantiated the client with an OAuth authorizer already (or set it as an instance variable just before calling the method)
- A single method that receives an optional "authorizer" argument, so that you could pass in an OAuth authorizer when you go to make the call. I think this would be nicer, but completely inconsistent with other client code out there (and with other authenticated methods on this same class).
The current approach has the downside that it provides two different methods for what translates to a single API call, but I think we'd need to have two call sites already. I imagine the client code will be something like:
if self.has_a_token:
authorizer = OAuthAuthorizer
api = SoftwareCenterR
else:
api = SoftwareCenterR
Let me know if you think some other alternative would be better!
LGTM