Merge lp:~mbp/lazr.restfulclient/626960-keyerror into lp:lazr.restfulclient

Proposed by Martin Pool
Status: Merged
Approved by: Graham Binns
Approved revision: 119
Merged at revision: 119
Proposed branch: lp:~mbp/lazr.restfulclient/626960-keyerror
Merge into: lp:lazr.restfulclient
Diff against target: 15 lines (+4/-1)
1 file modified
src/lazr/restfulclient/resource.py (+4/-1)
To merge this branch: bzr merge lp:~mbp/lazr.restfulclient/626960-keyerror
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+71667@code.launchpad.net

Description of the change

per bug 626960, lazr.restfulclient currently treats any http error reading from a collection as a KeyError, which causes confusion as in <https://bugs.launchpad.net/udd/+bug/827263> - and possibly actually wrong results.

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/lazr/restfulclient/resource.py'
2--- src/lazr/restfulclient/resource.py 2011-05-27 22:16:19 +0000
3+++ src/lazr/restfulclient/resource.py 2011-08-16 11:19:23 +0000
4@@ -947,7 +947,10 @@
5 try:
6 shim_resource._ensure_representation()
7 except HTTPError, e:
8- raise KeyError(key)
9+ if e.response.status == 404:
10+ raise KeyError(key)
11+ else:
12+ raise
13 return shim_resource
14
15 def __call__(self, key):

Subscribers

People subscribed via source and target branches