Merge lp:~leonardr/lazr.restful/fix-ws-accept-on-redirect into lp:lazr.restful

Proposed by Leonard Richardson on 2011-01-17
Status: Merged
Approved by: Edwin Grubbs on 2011-01-17
Approved revision: 159
Merged at revision: 158
Proposed branch: lp:~leonardr/lazr.restful/fix-ws-accept-on-redirect
Merge into: lp:lazr.restful
Diff against target: 56 lines (+16/-3)
4 files modified
src/lazr/restful/NEWS.txt (+6/-0)
src/lazr/restful/example/base/tests/redirect.txt (+8/-0)
src/lazr/restful/publisher.py (+1/-2)
src/lazr/restful/version.txt (+1/-1)
To merge this branch: bzr merge lp:~leonardr/lazr.restful/fix-ws-accept-on-redirect
Reviewer Review Type Date Requested Status
Edwin Grubbs (community) code 2011-01-17 Approve on 2011-01-17
Review via email: mp+46552@code.launchpad.net

Description of the Change

This branch fixes bug 704214. It should be pretty straightforward.

To post a comment you must log in.
Edwin Grubbs (edwin-grubbs) wrote :

Looks good.

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/restful/NEWS.txt'
2--- src/lazr/restful/NEWS.txt 2010-11-30 19:03:08 +0000
3+++ src/lazr/restful/NEWS.txt 2011-01-17 23:55:27 +0000
4@@ -2,6 +2,12 @@
5 NEWS for lazr.restful
6 =====================
7
8+Unreleased
9+==========
10+
11+Fixed a redirect bug when a web browser requests a representation
12+other than JSON.
13+
14 0.15.0 (2010-11-30)
15 ===================
16
17
18=== modified file 'src/lazr/restful/example/base/tests/redirect.txt'
19--- src/lazr/restful/example/base/tests/redirect.txt 2010-09-29 16:23:00 +0000
20+++ src/lazr/restful/example/base/tests/redirect.txt 2011-01-17 23:55:27 +0000
21@@ -34,6 +34,14 @@
22 Location: http://.../cookbooks/Mastering%20the%20Art%20of%20French%20Cooking?ws.accept=application/json
23 ...
24
25+ >>> print ajax.get(
26+ ... "/cookbooks/featured",
27+ ... headers=dict(Accept="application/xhtml+xml"))
28+ HTTP/1.1 301 Moved Permanently
29+ ...
30+ Location: http://...?ws.accept=application/xhtml%2Bxml
31+ ...
32+
33 The redirect works even if the redirect URI contains characters not
34 valid in URIs. In this case, the redirect is to a URL that contains
35 curly braces (see traversal.py for details).
36
37=== modified file 'src/lazr/restful/publisher.py'
38--- src/lazr/restful/publisher.py 2010-09-27 16:40:28 +0000
39+++ src/lazr/restful/publisher.py 2011-01-17 23:55:27 +0000
40@@ -187,8 +187,7 @@
41 # able to serve the right document.
42 location = request.response.getHeader("Location", None)
43 if location is not None:
44- accept = request.response.getHeader(
45- "Accept", "application/json")
46+ accept = request.getHeader("Accept", "application/json")
47 qs_append = "ws.accept=" + urllib.quote(accept)
48 # We don't use the URI class because it will raise
49 # an exception if the Location contains invalid
50
51=== modified file 'src/lazr/restful/version.txt'
52--- src/lazr/restful/version.txt 2010-11-18 20:58:01 +0000
53+++ src/lazr/restful/version.txt 2011-01-17 23:55:27 +0000
54@@ -1,1 +1,1 @@
55-0.15.0
56+0.15.1

Subscribers

People subscribed via source and target branches