Merge lp:~leonardr/lazr.restful/fix-media-type-misspelling into lp:lazr.restful
- fix-media-type-misspelling
- Merge into trunk
Proposed by
Leonard Richardson
Status: | Merged |
---|---|
Approved by: | Gavin Panella |
Approved revision: | 90 |
Merged at revision: | not available |
Proposed branch: | lp:~leonardr/lazr.restful/fix-media-type-misspelling |
Merge into: | lp:lazr.restful |
Diff against target: |
330 lines 7 files modified
src/lazr/restful/NEWS.txt (+5/-0) src/lazr/restful/_bytestorage.py (+3/-3) src/lazr/restful/_resource.py (+14/-8) src/lazr/restful/example/base/tests/entry.txt (+14/-7) src/lazr/restful/example/base/tests/wadl.txt (+39/-10) src/lazr/restful/templates/wadl-root.pt (+3/-3) src/lazr/restful/version.txt (+1/-1) |
To merge this branch: | bzr merge lp:~leonardr/lazr.restful/fix-media-type-misspelling |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella | Approve | ||
Review via email: mp+13711@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Leonard Richardson (leonardr) wrote : | # |
Revision history for this message
Gavin Panella (allenap) : | # |
review:
Approve
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 2009-10-20 17:07:56 +0000 | |||
3 | +++ src/lazr/restful/NEWS.txt 2009-10-21 15:00:30 +0000 | |||
4 | @@ -2,6 +2,11 @@ | |||
5 | 2 | NEWS for lazr.restful | 2 | NEWS for lazr.restful |
6 | 3 | ===================== | 3 | ===================== |
7 | 4 | 4 | ||
8 | 5 | 0.9.15 (2009-10-21) | ||
9 | 6 | =================== | ||
10 | 7 | |||
11 | 8 | Corrected a misspelling of the WADL media type. | ||
12 | 9 | |||
13 | 5 | 0.9.14 (2009-10-20) | 10 | 0.9.14 (2009-10-20) |
14 | 6 | =================== | 11 | =================== |
15 | 7 | 12 | ||
16 | 8 | 13 | ||
17 | === modified file 'src/lazr/restful/_bytestorage.py' | |||
18 | --- src/lazr/restful/_bytestorage.py 2009-03-26 17:25:22 +0000 | |||
19 | +++ src/lazr/restful/_bytestorage.py 2009-10-21 15:00:30 +0000 | |||
20 | @@ -59,10 +59,10 @@ | |||
21 | 59 | 59 | ||
22 | 60 | def do_GET(self): | 60 | def do_GET(self): |
23 | 61 | """See `IByteStorageResource`.""" | 61 | """See `IByteStorageResource`.""" |
25 | 62 | if self.getPreferredSupportedContentType() == self.WADL_TYPE: | 62 | media_type = self.getPreferredSupportedContentType() |
26 | 63 | if media_type in [self.WADL_TYPE, self.DEPRECATED_WADL_TYPE]: | ||
27 | 63 | result = self.toWADL().encode("utf-8") | 64 | result = self.toWADL().encode("utf-8") |
30 | 64 | self.request.response.setHeader( | 65 | self.request.response.setHeader('Content-Type', media_type) |
29 | 65 | 'Content-Type', self.WADL_TYPE) | ||
31 | 66 | return result | 66 | return result |
32 | 67 | if not self.context.is_stored: | 67 | if not self.context.is_stored: |
33 | 68 | # No stored document exists here yet. | 68 | # No stored document exists here yet. |
34 | 69 | 69 | ||
35 | === modified file 'src/lazr/restful/_resource.py' | |||
36 | --- src/lazr/restful/_resource.py 2009-10-20 17:00:23 +0000 | |||
37 | +++ src/lazr/restful/_resource.py 2009-10-21 15:00:30 +0000 | |||
38 | @@ -171,10 +171,15 @@ | |||
39 | 171 | implements(IHTTPResource) | 171 | implements(IHTTPResource) |
40 | 172 | 172 | ||
41 | 173 | # Some interesting media types. | 173 | # Some interesting media types. |
43 | 174 | WADL_TYPE = 'application/vd.sun.wadl+xml' | 174 | WADL_TYPE = 'application/vnd.sun.wadl+xml' |
44 | 175 | JSON_TYPE = 'application/json' | 175 | JSON_TYPE = 'application/json' |
45 | 176 | XHTML_TYPE = 'application/xhtml+xml' | 176 | XHTML_TYPE = 'application/xhtml+xml' |
46 | 177 | 177 | ||
47 | 178 | # This misspelling of the WADL media type was used for a while, | ||
48 | 179 | # and lazr.restful still supports it to avoid breaking clients | ||
49 | 180 | # that depend on it. | ||
50 | 181 | DEPRECATED_WADL_TYPE = 'application/vd.sun.wadl+xml' | ||
51 | 182 | |||
52 | 178 | # A preparsed template file for WADL representations of resources. | 183 | # A preparsed template file for WADL representations of resources. |
53 | 179 | WADL_TEMPLATE = LazrPageTemplateFile('templates/wadl-resource.pt') | 184 | WADL_TEMPLATE = LazrPageTemplateFile('templates/wadl-resource.pt') |
54 | 180 | 185 | ||
55 | @@ -183,7 +188,7 @@ | |||
56 | 183 | 188 | ||
57 | 184 | # All resources serve WADL and JSON representations. Only entry | 189 | # All resources serve WADL and JSON representations. Only entry |
58 | 185 | # resources serve XHTML representations. | 190 | # resources serve XHTML representations. |
60 | 186 | SUPPORTED_CONTENT_TYPES = [WADL_TYPE, JSON_TYPE] | 191 | SUPPORTED_CONTENT_TYPES = [WADL_TYPE, DEPRECATED_WADL_TYPE, JSON_TYPE] |
61 | 187 | 192 | ||
62 | 188 | def __init__(self, context, request): | 193 | def __init__(self, context, request): |
63 | 189 | self.context = context | 194 | self.context = context |
64 | @@ -311,7 +316,7 @@ | |||
65 | 311 | if etag is not None: | 316 | if etag is not None: |
66 | 312 | return etag | 317 | return etag |
67 | 313 | 318 | ||
69 | 314 | if media_type == self.WADL_TYPE: | 319 | if media_type in [self.WADL_TYPE, self.DEPRECATED_WADL_TYPE]: |
70 | 315 | # The WADL representation of a resource only changes when | 320 | # The WADL representation of a resource only changes when |
71 | 316 | # the software itself changes. Thus, we don't need any | 321 | # the software itself changes. Thus, we don't need any |
72 | 317 | # special information for its ETag core. | 322 | # special information for its ETag core. |
73 | @@ -1221,6 +1226,7 @@ | |||
74 | 1221 | implements(IEntryResource, IJSONPublishable) | 1226 | implements(IEntryResource, IJSONPublishable) |
75 | 1222 | 1227 | ||
76 | 1223 | SUPPORTED_CONTENT_TYPES = [HTTPResource.WADL_TYPE, | 1228 | SUPPORTED_CONTENT_TYPES = [HTTPResource.WADL_TYPE, |
77 | 1229 | HTTPResource.DEPRECATED_WADL_TYPE, | ||
78 | 1224 | HTTPResource.XHTML_TYPE, | 1230 | HTTPResource.XHTML_TYPE, |
79 | 1225 | HTTPResource.JSON_TYPE] | 1231 | HTTPResource.JSON_TYPE] |
80 | 1226 | 1232 | ||
81 | @@ -1405,7 +1411,7 @@ | |||
82 | 1405 | 1411 | ||
83 | 1406 | def _representation(self, media_type): | 1412 | def _representation(self, media_type): |
84 | 1407 | """Return a representation of this entry, of the given media type.""" | 1413 | """Return a representation of this entry, of the given media type.""" |
86 | 1408 | if media_type == self.WADL_TYPE: | 1414 | if media_type in [self.WADL_TYPE, self.DEPRECATED_WADL_TYPE]: |
87 | 1409 | return self.toWADL().encode("utf-8") | 1415 | return self.toWADL().encode("utf-8") |
88 | 1410 | elif media_type == self.JSON_TYPE: | 1416 | elif media_type == self.JSON_TYPE: |
89 | 1411 | return simplejson.dumps(self, cls=ResourceJSONEncoder) | 1417 | return simplejson.dumps(self, cls=ResourceJSONEncoder) |
90 | @@ -1446,10 +1452,10 @@ | |||
91 | 1446 | if entries is None: | 1452 | if entries is None: |
92 | 1447 | raise NotFound(self, self.collection_name) | 1453 | raise NotFound(self, self.collection_name) |
93 | 1448 | 1454 | ||
95 | 1449 | if self.getPreferredSupportedContentType() == self.WADL_TYPE: | 1455 | media_type = self.getPreferredSupportedContentType() |
96 | 1456 | if media_type in [self.DEPRECATED_WADL_TYPE, self.WADL_TYPE]: | ||
97 | 1450 | result = self.toWADL().encode("utf-8") | 1457 | result = self.toWADL().encode("utf-8") |
100 | 1451 | self.request.response.setHeader( | 1458 | self.request.response.setHeader('Content-Type', media_type) |
99 | 1452 | 'Content-Type', self.WADL_TYPE) | ||
101 | 1453 | return result | 1459 | return result |
102 | 1454 | 1460 | ||
103 | 1455 | result = self.batch(entries) | 1461 | result = self.batch(entries) |
104 | @@ -1540,7 +1546,7 @@ | |||
105 | 1540 | if media_type is None: | 1546 | if media_type is None: |
106 | 1541 | # The conditional GET succeeded. Serve nothing. | 1547 | # The conditional GET succeeded. Serve nothing. |
107 | 1542 | return "" | 1548 | return "" |
109 | 1543 | elif media_type == self.WADL_TYPE: | 1549 | elif media_type in [self.WADL_TYPE, self.DEPRECATED_WADL_TYPE]: |
110 | 1544 | result = self.toWADL().encode("utf-8") | 1550 | result = self.toWADL().encode("utf-8") |
111 | 1545 | elif media_type == self.JSON_TYPE: | 1551 | elif media_type == self.JSON_TYPE: |
112 | 1546 | # Serve a JSON map containing links to all the top-level | 1552 | # Serve a JSON map containing links to all the top-level |
113 | 1547 | 1553 | ||
114 | === modified file 'src/lazr/restful/example/base/tests/entry.txt' | |||
115 | --- src/lazr/restful/example/base/tests/entry.txt 2009-09-01 13:10:07 +0000 | |||
116 | +++ src/lazr/restful/example/base/tests/entry.txt 2009-10-21 15:00:30 +0000 | |||
117 | @@ -52,8 +52,8 @@ | |||
118 | 52 | >>> negotiated_type('application/xhtml+xml') | 52 | >>> negotiated_type('application/xhtml+xml') |
119 | 53 | 'application/xhtml+xml' | 53 | 'application/xhtml+xml' |
120 | 54 | 54 | ||
123 | 55 | >>> negotiated_type('application/vd.sun.wadl+xml') | 55 | >>> negotiated_type('application/vnd.sun.wadl+xml') |
124 | 56 | 'application/vd.sun.wadl+xml' | 56 | 'application/vnd.sun.wadl+xml' |
125 | 57 | 57 | ||
126 | 58 | >>> negotiated_type(None) | 58 | >>> negotiated_type(None) |
127 | 59 | 'application/json' | 59 | 'application/json' |
128 | @@ -61,18 +61,18 @@ | |||
129 | 61 | >>> negotiated_type('text/html') | 61 | >>> negotiated_type('text/html') |
130 | 62 | 'application/json' | 62 | 'application/json' |
131 | 63 | 63 | ||
133 | 64 | >>> negotiated_type('application/json, application/vd.sun.wadl+xml') | 64 | >>> negotiated_type('application/json, application/vnd.sun.wadl+xml') |
134 | 65 | 'application/json' | 65 | 'application/json' |
135 | 66 | 66 | ||
136 | 67 | >>> negotiated_type('application/json, application/xhtml+xml') | 67 | >>> negotiated_type('application/json, application/xhtml+xml') |
137 | 68 | 'application/json' | 68 | 'application/json' |
138 | 69 | 69 | ||
140 | 70 | >>> negotiated_type('application/vd.sun.wadl+xml, text/html, ' | 70 | >>> negotiated_type('application/vnd.sun.wadl+xml, text/html, ' |
141 | 71 | ... 'application/json') | 71 | ... 'application/json') |
143 | 72 | 'application/vd.sun.wadl+xml' | 72 | 'application/vnd.sun.wadl+xml' |
144 | 73 | 73 | ||
147 | 74 | >>> negotiated_type('application/json;q=0.5, application/vd.sun.wadl+xml') | 74 | >>> negotiated_type('application/json;q=0.5, application/vnd.sun.wadl+xml') |
148 | 75 | 'application/vd.sun.wadl+xml' | 75 | 'application/vnd.sun.wadl+xml' |
149 | 76 | 76 | ||
150 | 77 | >>> negotiated_type('application/json;q=0, application/xhtml+xml;q=0.05,' | 77 | >>> negotiated_type('application/json;q=0, application/xhtml+xml;q=0.05,' |
151 | 78 | ... 'application/vd.sun.wadl+xml;q=0.1') | 78 | ... 'application/vd.sun.wadl+xml;q=0.1') |
152 | @@ -95,6 +95,13 @@ | |||
153 | 95 | ... 'application/json;q=0.5, application/xhtml+xml;q=0,') | 95 | ... 'application/json;q=0.5, application/xhtml+xml;q=0,') |
154 | 96 | 'application/xhtml+xml' | 96 | 'application/xhtml+xml' |
155 | 97 | 97 | ||
156 | 98 | Earlier versions of lazr.restful served a misspelling of the WADL | ||
157 | 99 | media type. For purposes of backwards compatibility, lazr.restful | ||
158 | 100 | will still serve this media type if it's requested. | ||
159 | 101 | |||
160 | 102 | >>> negotiated_type('application/vd.sun.wadl+xml') | ||
161 | 103 | 'application/vd.sun.wadl+xml' | ||
162 | 104 | |||
163 | 98 | XHTML representations | 105 | XHTML representations |
164 | 99 | ===================== | 106 | ===================== |
165 | 100 | 107 | ||
166 | 101 | 108 | ||
167 | === modified file 'src/lazr/restful/example/base/tests/wadl.txt' | |||
168 | --- src/lazr/restful/example/base/tests/wadl.txt 2009-07-07 18:30:11 +0000 | |||
169 | +++ src/lazr/restful/example/base/tests/wadl.txt 2009-10-21 15:00:30 +0000 | |||
170 | @@ -18,7 +18,7 @@ | |||
171 | 18 | >>> webservice = WebServiceCaller(domain='cookbooks.dev') | 18 | >>> webservice = WebServiceCaller(domain='cookbooks.dev') |
172 | 19 | >>> entry_url = quote("/cookbooks/The Joy of Cooking") | 19 | >>> entry_url = quote("/cookbooks/The Joy of Cooking") |
173 | 20 | >>> wadl = webservice.get( | 20 | >>> wadl = webservice.get( |
175 | 21 | ... entry_url, 'application/vd.sun.wadl+xml').body | 21 | ... entry_url, 'application/vnd.sun.wadl+xml').body |
176 | 22 | 22 | ||
177 | 23 | It's an XML document. | 23 | It's an XML document. |
178 | 24 | 24 | ||
179 | @@ -112,7 +112,7 @@ | |||
180 | 112 | <resources> tag that contains a <resource> tag. | 112 | <resources> tag that contains a <resource> tag. |
181 | 113 | 113 | ||
182 | 114 | >>> wadl = webservice.get('/cookbooks', | 114 | >>> wadl = webservice.get('/cookbooks', |
184 | 115 | ... 'application/vd.sun.wadl+xml').body | 115 | ... 'application/vnd.sun.wadl+xml').body |
185 | 116 | >>> validate(wadl) | 116 | >>> validate(wadl) |
186 | 117 | True | 117 | True |
187 | 118 | 118 | ||
188 | @@ -145,7 +145,7 @@ | |||
189 | 145 | the representation of a top-level collection. | 145 | the representation of a top-level collection. |
190 | 146 | 146 | ||
191 | 147 | >>> wadl = webservice.get(entry_url + '/recipes', | 147 | >>> wadl = webservice.get(entry_url + '/recipes', |
193 | 148 | ... 'application/vd.sun.wadl+xml').body | 148 | ... 'application/vnd.sun.wadl+xml').body |
194 | 149 | >>> validate(wadl) | 149 | >>> validate(wadl) |
195 | 150 | True | 150 | True |
196 | 151 | 151 | ||
197 | @@ -194,7 +194,7 @@ | |||
198 | 194 | 194 | ||
199 | 195 | >>> wadl = webservice.get( | 195 | >>> wadl = webservice.get( |
200 | 196 | ... entry_url + '/cover', | 196 | ... entry_url + '/cover', |
202 | 197 | ... 'application/vd.sun.wadl+xml').body | 197 | ... 'application/vnd.sun.wadl+xml').body |
203 | 198 | >>> validate(wadl) | 198 | >>> validate(wadl) |
204 | 199 | True | 199 | True |
205 | 200 | 200 | ||
206 | @@ -237,7 +237,7 @@ | |||
207 | 237 | resources. It's a big document. | 237 | resources. It's a big document. |
208 | 238 | 238 | ||
209 | 239 | >>> wadl = webservice.get( | 239 | >>> wadl = webservice.get( |
211 | 240 | ... '/', 'application/vd.sun.wadl+xml').body | 240 | ... '/', 'application/vnd.sun.wadl+xml').body |
212 | 241 | >>> validate(wadl) | 241 | >>> validate(wadl) |
213 | 242 | True | 242 | True |
214 | 243 | >>> tree = etree.fromstring(wadl) | 243 | >>> tree = etree.fromstring(wadl) |
215 | @@ -294,7 +294,7 @@ | |||
216 | 294 | >>> json_repr.attrib['href'] | 294 | >>> json_repr.attrib['href'] |
217 | 295 | '#service-root-json' | 295 | '#service-root-json' |
218 | 296 | >>> wadl_repr.attrib['mediaType'] | 296 | >>> wadl_repr.attrib['mediaType'] |
220 | 297 | 'application/vd.sun.wadl+xml' | 297 | 'application/vnd.sun.wadl+xml' |
221 | 298 | 298 | ||
222 | 299 | The details of the 'service-root-json' representation are given | 299 | The details of the 'service-root-json' representation are given |
223 | 300 | immediately afterwards: | 300 | immediately afterwards: |
224 | @@ -425,7 +425,7 @@ | |||
225 | 425 | <method name="GET" id="CookbookCollection-get"> | 425 | <method name="GET" id="CookbookCollection-get"> |
226 | 426 | <response> | 426 | <response> |
227 | 427 | <representation href="http://.../#cookbook-page"/> | 427 | <representation href="http://.../#cookbook-page"/> |
229 | 428 | <representation mediaType="application/vd.sun.wadl+xml" | 428 | <representation mediaType="application/vnd.sun.wadl+xml" |
230 | 429 | id="CookbookCollection-wadl"/> | 429 | id="CookbookCollection-wadl"/> |
231 | 430 | </response> | 430 | </response> |
232 | 431 | </method> | 431 | </method> |
233 | @@ -458,7 +458,7 @@ | |||
234 | 458 | <response> | 458 | <response> |
235 | 459 | <representation | 459 | <representation |
236 | 460 | href="http://.../#message-full"/> | 460 | href="http://.../#message-full"/> |
238 | 461 | <representation mediaType="application/vd.sun.wadl+xml" | 461 | <representation mediaType="application/vnd.sun.wadl+xml" |
239 | 462 | id="message-wadl"/> | 462 | id="message-wadl"/> |
240 | 463 | </response> | 463 | </response> |
241 | 464 | </method> | 464 | </method> |
242 | @@ -577,7 +577,7 @@ | |||
243 | 577 | 'http://...#cookbook-page' | 577 | 'http://...#cookbook-page' |
244 | 578 | 578 | ||
245 | 579 | >>> wadl_rep.attrib['mediaType'] | 579 | >>> wadl_rep.attrib['mediaType'] |
247 | 580 | 'application/vd.sun.wadl+xml' | 580 | 'application/vnd.sun.wadl+xml' |
248 | 581 | >>> wadl_rep.attrib['id'] | 581 | >>> wadl_rep.attrib['id'] |
249 | 582 | 'cookbooks-wadl' | 582 | 'cookbooks-wadl' |
250 | 583 | 583 | ||
251 | @@ -951,7 +951,7 @@ | |||
252 | 951 | >>> wadl.attrib['id'] | 951 | >>> wadl.attrib['id'] |
253 | 952 | 'cookbook-wadl' | 952 | 'cookbook-wadl' |
254 | 953 | >>> wadl.attrib['mediaType'] | 953 | >>> wadl.attrib['mediaType'] |
256 | 954 | 'application/vd.sun.wadl+xml' | 954 | 'application/vnd.sun.wadl+xml' |
257 | 955 | 955 | ||
258 | 956 | Note that the JSON representation is just a hyperlink to the | 956 | Note that the JSON representation is just a hyperlink to the |
259 | 957 | representation defined earlier. | 957 | representation defined earlier. |
260 | @@ -1175,3 +1175,32 @@ | |||
261 | 1175 | >>> prev_type = single_list_value(prev) | 1175 | >>> prev_type = single_list_value(prev) |
262 | 1176 | >>> prev_type.attrib['resource_type'] | 1176 | >>> prev_type.attrib['resource_type'] |
263 | 1177 | '#cookbook-page-resource' | 1177 | '#cookbook-page-resource' |
264 | 1178 | |||
265 | 1179 | Misspelled media type | ||
266 | 1180 | ===================== | ||
267 | 1181 | |||
268 | 1182 | Earlier versions of lazr.restful served WADL documents with a | ||
269 | 1183 | misspelled media type. For purposes of backwards compatibility, a | ||
270 | 1184 | client can still request this media type, and lazr.restful will serve | ||
271 | 1185 | a standard WADL document with a misspelled Content-Type. | ||
272 | 1186 | |||
273 | 1187 | >>> misspelling = 'application/vd.sun.wadl+xml' | ||
274 | 1188 | >>> misspelled_response = webservice.get("/", misspelling) | ||
275 | 1189 | >>> misspelled_response.getHeader("Content-Type") == misspelling | ||
276 | 1190 | True | ||
277 | 1191 | |||
278 | 1192 | >>> wadl_from_misspelled_response = misspelled_response.body | ||
279 | 1193 | >>> validate(wadl_from_misspelled_response) | ||
280 | 1194 | True | ||
281 | 1195 | |||
282 | 1196 | This works with any kind of resource you might request the WADL for: | ||
283 | 1197 | the service root, an entry resource, or a hosted binary file resource. | ||
284 | 1198 | |||
285 | 1199 | >>> misspelled_response = webservice.get(entry_url, misspelling) | ||
286 | 1200 | >>> misspelled_response.getHeader("Content-Type") == misspelling | ||
287 | 1201 | True | ||
288 | 1202 | |||
289 | 1203 | >>> misspelled_response = webservice.get( | ||
290 | 1204 | ... entry_url + "/cover", misspelling) | ||
291 | 1205 | >>> misspelled_response.getHeader("Content-Type") == misspelling | ||
292 | 1206 | True | ||
293 | 1178 | 1207 | ||
294 | === modified file 'src/lazr/restful/templates/wadl-root.pt' | |||
295 | --- src/lazr/restful/templates/wadl-root.pt 2009-10-15 15:32:57 +0000 | |||
296 | +++ src/lazr/restful/templates/wadl-root.pt 2009-10-21 15:00:30 +0000 | |||
297 | @@ -24,7 +24,7 @@ | |||
298 | 24 | <method name="GET" id="service-root-get"> | 24 | <method name="GET" id="service-root-get"> |
299 | 25 | <response> | 25 | <response> |
300 | 26 | <representation href="#service-root-json" /> | 26 | <representation href="#service-root-json" /> |
302 | 27 | <representation mediaType="application/vd.sun.wadl+xml" | 27 | <representation mediaType="application/vnd.sun.wadl+xml" |
303 | 28 | id="service-root-wadl" /> | 28 | id="service-root-wadl" /> |
304 | 29 | </response> | 29 | </response> |
305 | 30 | </method> | 30 | </method> |
306 | @@ -64,7 +64,7 @@ | |||
307 | 64 | tal:attributes=" | 64 | tal:attributes=" |
308 | 65 | href entry_schema/wadl_entry_interface:entry_page_representation_link" | 65 | href entry_schema/wadl_entry_interface:entry_page_representation_link" |
309 | 66 | /> | 66 | /> |
311 | 67 | <representation mediaType="application/vd.sun.wadl+xml" | 67 | <representation mediaType="application/vnd.sun.wadl+xml" |
312 | 68 | tal:attributes="id string:${context/wadl_collection:collection_type}-wadl" /> | 68 | tal:attributes="id string:${context/wadl_collection:collection_type}-wadl" /> |
313 | 69 | </response> | 69 | </response> |
314 | 70 | </method> | 70 | </method> |
315 | @@ -133,7 +133,7 @@ | |||
316 | 133 | tal:attributes="href context/wadl_entry:full_representation_link" /> | 133 | tal:attributes="href context/wadl_entry:full_representation_link" /> |
317 | 134 | <representation mediaType="application/xhtml+xml" | 134 | <representation mediaType="application/xhtml+xml" |
318 | 135 | tal:attributes="id string:${context/wadl_entry:singular_type}-xhtml" /> | 135 | tal:attributes="id string:${context/wadl_entry:singular_type}-xhtml" /> |
320 | 136 | <representation mediaType="application/vd.sun.wadl+xml" | 136 | <representation mediaType="application/vnd.sun.wadl+xml" |
321 | 137 | tal:attributes="id string:${context/wadl_entry:singular_type}-wadl" /> | 137 | tal:attributes="id string:${context/wadl_entry:singular_type}-wadl" /> |
322 | 138 | </response> | 138 | </response> |
323 | 139 | </method> | 139 | </method> |
324 | 140 | 140 | ||
325 | === modified file 'src/lazr/restful/version.txt' | |||
326 | --- src/lazr/restful/version.txt 2009-10-20 17:07:56 +0000 | |||
327 | +++ src/lazr/restful/version.txt 2009-10-21 15:00:30 +0000 | |||
328 | @@ -1,1 +1,1 @@ | |||
330 | 1 | 0.9.14 | 1 | 0.9.15 |
This branch fixes bug 457146 by correcting a misspelling of the WADL media type.
The complication is that if we simply correct the misspelling, old versions of lazr.restfulclient will stop working (they'll be served JSON representations instead of WADL). So we need to treat old clients the same way we did before.
I changed all references to the old media type to the new media type, and all code that pivots on the old media type to operate on either the old or new media type. I was a little worried that my changes to the WADL template itself would break old versions of lazr.restfulclient, but a test with an actual old version showed that it didn't matter.
I added tests to wadl.txt that show how to get WADL representations using the misspelled media type. Just to make extra sure, I also ran the entire wadl.txt suite before correcting the misspelling, to make sure that all the old code still worked.