Merge lp:~wallyworld/lazr.restfulclient/named-post-url-change-1056546 into lp:lazr.restfulclient
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Curtis Hovey | ||||
Approved revision: | 136 | ||||
Merged at revision: | 133 | ||||
Proposed branch: | lp:~wallyworld/lazr.restfulclient/named-post-url-change-1056546 | ||||
Merge into: | lp:lazr.restfulclient | ||||
Diff against target: |
80 lines (+28/-4) 5 files modified
src/lazr/restfulclient/NEWS.txt (+6/-0) src/lazr/restfulclient/docs/operations.txt (+13/-0) src/lazr/restfulclient/resource.py (+7/-2) src/lazr/restfulclient/version.txt (+1/-1) versions.cfg (+1/-1) |
||||
To merge this branch: | bzr merge lp:~wallyworld/lazr.restfulclient/named-post-url-change-1056546 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Curtis Hovey (community) | code | Approve | |
Review via email: mp+126375@code.launchpad.net |
Commit message
If a Location header is in a named operation post response, use it as the replacement url for the resource.
Description of the change
A named post operation may result in the resource on which the post is operating to have a different url at the end of the operation. When the lazr restful client has finished making the api call, it invokes lp_refresh() to get the new state of the resource, and this fails with a 404 if the url has changed, since the old url is all the client knows about.
I added a bit of code to detect the 301 response and reload the resource if necessary.
I added a dependency on the corresponding new lazr.resful lib and updated a doctest to reflect the new behaviour.
Thank you. Users do not install this lib. I doubt it will even be backported to LTS releases, so I expect users will still see this problem for years after we release the fix.