Merge lp:~leonardr/lazr.restful/no-latest-version into lp:lazr.restful
- no-latest-version
- Merge into trunk
Proposed by
Leonard Richardson
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~leonardr/lazr.restful/no-latest-version |
Merge into: | lp:lazr.restful |
Diff against target: |
340 lines (+35/-67) 18 files modified
src/lazr/restful/NEWS.txt (+8/-12) src/lazr/restful/_resource.py (+1/-4) src/lazr/restful/directives/__init__.py (+1/-2) src/lazr/restful/docs/absoluteurl.txt (+3/-4) src/lazr/restful/docs/multiversion.txt (+1/-2) src/lazr/restful/docs/webservice-declarations.txt (+0/-1) src/lazr/restful/docs/webservice-error.txt (+1/-1) src/lazr/restful/docs/webservice.txt (+1/-2) src/lazr/restful/example/base/root.py (+3/-3) src/lazr/restful/example/base/tests/field.txt (+1/-1) src/lazr/restful/example/base/tests/root.txt (+2/-2) src/lazr/restful/example/base/tests/wadl.txt (+1/-1) src/lazr/restful/example/multiversion/root.py (+1/-2) src/lazr/restful/interfaces/_rest.py (+6/-20) src/lazr/restful/metazcml.py (+1/-4) src/lazr/restful/publisher.py (+2/-4) src/lazr/restful/testing/webservice.py (+1/-1) src/lazr/restful/tests/test_webservice.py (+1/-1) |
To merge this branch: | bzr merge lp:~leonardr/lazr.restful/no-latest-version |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gary Poster | Approve | ||
Review via email: mp+19122@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 : | # |
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-02-10 21:44:13 +0000 | |||
3 | +++ src/lazr/restful/NEWS.txt 2010-02-11 18:16:16 +0000 | |||
4 | @@ -7,8 +7,7 @@ | |||
5 | 7 | 7 | ||
6 | 8 | Special note: this version contains backwards-incompatible | 8 | Special note: this version contains backwards-incompatible |
7 | 9 | changes. You *must* change your configuration object to get your code | 9 | changes. You *must* change your configuration object to get your code |
10 | 10 | to work in this version! See "active_versions" and | 10 | to work in this version! See "active_versions" below. |
9 | 11 | "latest_version_uri_prefix" below. | ||
11 | 12 | 11 | ||
12 | 13 | Added a versioning system for web services. Clients can now request | 12 | Added a versioning system for web services. Clients can now request |
13 | 14 | any number of distinct versions as well as a floating "trunk" which is | 13 | any number of distinct versions as well as a floating "trunk" which is |
14 | @@ -17,17 +16,14 @@ | |||
15 | 17 | the example web service in example/multiversion/ to see how the | 16 | the example web service in example/multiversion/ to see how the |
16 | 18 | annotations work. | 17 | annotations work. |
17 | 19 | 18 | ||
18 | 20 | This release introduces a new field to IWebServiceConfiguration: | ||
19 | 21 | latest_version_uri_prefix. If you are rolling your own | ||
20 | 22 | IWebServiceConfiguration implementation, rather than subclassing from | ||
21 | 23 | BaseWebServiceConfiguration or one of its subclasses, you'll need to | ||
22 | 24 | set a value for this. | ||
23 | 25 | |||
24 | 26 | This release _replaces_ one of the fields in | 19 | This release _replaces_ one of the fields in |
29 | 27 | IWebServiceConfiguration. The string service_version_uri_prefix has | 20 | IWebServiceConfiguration. The string 'service_version_uri'_prefix has |
30 | 28 | become the list active_versions. The simplest way to deal with this is | 21 | become the list 'active_versions'. The simplest way to deal with this is |
31 | 29 | to just put your service_version_uri_prefix into a list and call it | 22 | to just put your 'service_version_uri_prefix' into a list and call it |
32 | 30 | active_versions. | 23 | 'active_versions'. We recommend you also add a floating "development" |
33 | 24 | version to the end of 'active_versions', calling it something like | ||
34 | 25 | "devel" or "trunk". This will give your users a permanent alias to | ||
35 | 26 | "the most recent version of the web service". | ||
36 | 31 | 27 | ||
37 | 32 | 0.9.17 (2009-11-10) | 28 | 0.9.17 (2009-11-10) |
38 | 33 | =================== | 29 | =================== |
39 | 34 | 30 | ||
40 | === modified file 'src/lazr/restful/_resource.py' | |||
41 | --- src/lazr/restful/_resource.py 2010-02-11 16:32:17 +0000 | |||
42 | +++ src/lazr/restful/_resource.py 2010-02-11 18:16:16 +0000 | |||
43 | @@ -1601,10 +1601,7 @@ | |||
44 | 1601 | 1601 | ||
45 | 1602 | # Determine the name of the earliest version. We'll be using this later. | 1602 | # Determine the name of the earliest version. We'll be using this later. |
46 | 1603 | config = getUtility(IWebServiceConfiguration) | 1603 | config = getUtility(IWebServiceConfiguration) |
51 | 1604 | if len(config.active_versions) > 0: | 1604 | earliest_version = config.active_versions[0] |
48 | 1605 | earliest_version = config.active_versions[0] | ||
49 | 1606 | else: | ||
50 | 1607 | earliest_version = config.latest_version_uri_prefix | ||
52 | 1608 | 1605 | ||
53 | 1609 | for registration in sorted(site_manager.registeredAdapters()): | 1606 | for registration in sorted(site_manager.registeredAdapters()): |
54 | 1610 | provided = registration.provided | 1607 | provided = registration.provided |
55 | 1611 | 1608 | ||
56 | === modified file 'src/lazr/restful/directives/__init__.py' | |||
57 | --- src/lazr/restful/directives/__init__.py 2010-02-03 15:24:00 +0000 | |||
58 | +++ src/lazr/restful/directives/__init__.py 2010-02-11 18:16:16 +0000 | |||
59 | @@ -99,8 +99,7 @@ | |||
60 | 99 | 99 | ||
61 | 100 | # Create and register marker interfaces for request objects. | 100 | # Create and register marker interfaces for request objects. |
62 | 101 | superclass = IWebServiceClientRequest | 101 | superclass = IWebServiceClientRequest |
65 | 102 | for version in ( | 102 | for version in (utility.active_versions): |
64 | 103 | utility.active_versions + [utility.latest_version_uri_prefix]): | ||
66 | 104 | name_part = make_identifier_safe(version) | 103 | name_part = make_identifier_safe(version) |
67 | 105 | if not name_part.startswith('_'): | 104 | if not name_part.startswith('_'): |
68 | 106 | name_part = '_' + name_part | 105 | name_part = '_' + name_part |
69 | 107 | 106 | ||
70 | === modified file 'src/lazr/restful/docs/absoluteurl.txt' | |||
71 | --- src/lazr/restful/docs/absoluteurl.txt 2009-11-12 19:08:10 +0000 | |||
72 | +++ src/lazr/restful/docs/absoluteurl.txt 2010-02-11 18:16:16 +0000 | |||
73 | @@ -29,8 +29,7 @@ | |||
74 | 29 | ... implements(IWebServiceConfiguration) | 29 | ... implements(IWebServiceConfiguration) |
75 | 30 | ... hostname = "hostname" | 30 | ... hostname = "hostname" |
76 | 31 | ... service_root_uri_prefix = "root_uri_prefix/" | 31 | ... service_root_uri_prefix = "root_uri_prefix/" |
79 | 32 | ... active_versions = ['active_version'] | 32 | ... active_versions = ['active_version', 'latest_version'] |
78 | 33 | ... latest_version_uri_prefix = "latest_version_uri_prefix" | ||
80 | 34 | ... port = 1000 | 33 | ... port = 1000 |
81 | 35 | ... use_https = True | 34 | ... use_https = True |
82 | 36 | 35 | ||
83 | @@ -85,10 +84,10 @@ | |||
84 | 85 | value of the 'lazr.restful.version' annotation. | 84 | value of the 'lazr.restful.version' annotation. |
85 | 86 | 85 | ||
86 | 87 | >>> request.annotations[request.VERSION_ANNOTATION] = ( | 86 | >>> request.annotations[request.VERSION_ANNOTATION] = ( |
88 | 88 | ... 'latest_version_uri_prefix') | 87 | ... 'latest_version') |
89 | 89 | >>> adapter = getMultiAdapter((resource, request), IAbsoluteURL) | 88 | >>> adapter = getMultiAdapter((resource, request), IAbsoluteURL) |
90 | 90 | >>> print adapter() | 89 | >>> print adapter() |
92 | 91 | http://hostname/root_uri_prefix/latest_version_uri_prefix/ | 90 | http://hostname/root_uri_prefix/latest_version/ |
93 | 92 | 91 | ||
94 | 93 | For purposes of URL generation, the annotation doesn't have to be a | 92 | For purposes of URL generation, the annotation doesn't have to be a |
95 | 94 | real version defined by the web service. Any string will do. | 93 | real version defined by the web service. Any string will do. |
96 | 95 | 94 | ||
97 | === modified file 'src/lazr/restful/docs/multiversion.txt' | |||
98 | --- src/lazr/restful/docs/multiversion.txt 2010-01-26 17:00:23 +0000 | |||
99 | +++ src/lazr/restful/docs/multiversion.txt 2010-02-11 18:16:16 +0000 | |||
100 | @@ -39,8 +39,7 @@ | |||
101 | 39 | >>> class WebServiceConfiguration(BaseWebServiceConfiguration): | 39 | >>> class WebServiceConfiguration(BaseWebServiceConfiguration): |
102 | 40 | ... hostname = 'api.multiversion.dev' | 40 | ... hostname = 'api.multiversion.dev' |
103 | 41 | ... use_https = False | 41 | ... use_https = False |
106 | 42 | ... active_versions = ['beta', '1.0'] | 42 | ... active_versions = ['beta', '1.0', 'dev'] |
105 | 43 | ... latest_version_uri_prefix = 'dev' | ||
107 | 44 | ... code_revision = 'test' | 43 | ... code_revision = 'test' |
108 | 45 | ... max_batch_size = 100 | 44 | ... max_batch_size = 100 |
109 | 46 | ... view_permission = None | 45 | ... view_permission = None |
110 | 47 | 46 | ||
111 | === modified file 'src/lazr/restful/docs/webservice-declarations.txt' | |||
112 | --- src/lazr/restful/docs/webservice-declarations.txt 2010-02-08 18:24:57 +0000 | |||
113 | +++ src/lazr/restful/docs/webservice-declarations.txt 2010-02-11 18:16:16 +0000 | |||
114 | @@ -905,7 +905,6 @@ | |||
115 | 905 | ... active_versions = ["beta", "1.0", "2.0", "3.0"] | 905 | ... active_versions = ["beta", "1.0", "2.0", "3.0"] |
116 | 906 | ... code_revision = "1.0b" | 906 | ... code_revision = "1.0b" |
117 | 907 | ... default_batch_size = 50 | 907 | ... default_batch_size = 50 |
118 | 908 | ... latest_version_uri_prefix = '3.0' | ||
119 | 909 | ... | 908 | ... |
120 | 910 | ... def get_request_user(self): | 909 | ... def get_request_user(self): |
121 | 911 | ... return 'A user' | 910 | ... return 'A user' |
122 | 912 | 911 | ||
123 | === modified file 'src/lazr/restful/docs/webservice-error.txt' | |||
124 | --- src/lazr/restful/docs/webservice-error.txt 2010-02-03 16:19:03 +0000 | |||
125 | +++ src/lazr/restful/docs/webservice-error.txt 2010-02-11 18:16:16 +0000 | |||
126 | @@ -16,7 +16,7 @@ | |||
127 | 16 | >>> class SimpleWebServiceConfiguration: | 16 | >>> class SimpleWebServiceConfiguration: |
128 | 17 | ... implements(IWebServiceConfiguration) | 17 | ... implements(IWebServiceConfiguration) |
129 | 18 | ... show_tracebacks = False | 18 | ... show_tracebacks = False |
131 | 19 | ... latest_version_uri_prefix = 'trunk' | 19 | ... active_versions = ['trunk'] |
132 | 20 | >>> webservice_configuration = SimpleWebServiceConfiguration() | 20 | >>> webservice_configuration = SimpleWebServiceConfiguration() |
133 | 21 | >>> sm.registerUtility(webservice_configuration) | 21 | >>> sm.registerUtility(webservice_configuration) |
134 | 22 | 22 | ||
135 | 23 | 23 | ||
136 | === modified file 'src/lazr/restful/docs/webservice.txt' | |||
137 | --- src/lazr/restful/docs/webservice.txt 2010-02-11 14:44:16 +0000 | |||
138 | +++ src/lazr/restful/docs/webservice.txt 2010-02-11 18:16:16 +0000 | |||
139 | @@ -500,8 +500,7 @@ | |||
140 | 500 | >>> class WebServiceConfiguration(BaseWebServiceConfiguration): | 500 | >>> class WebServiceConfiguration(BaseWebServiceConfiguration): |
141 | 501 | ... hostname = 'api.cookbooks.dev' | 501 | ... hostname = 'api.cookbooks.dev' |
142 | 502 | ... use_https = False | 502 | ... use_https = False |
145 | 503 | ... active_versions = ['beta'] | 503 | ... active_versions = ['beta', 'devel'] |
144 | 504 | ... latest_version_uri_prefix = 'devel' | ||
146 | 505 | ... code_revision = 'test' | 504 | ... code_revision = 'test' |
147 | 506 | ... max_batch_size = 100 | 505 | ... max_batch_size = 100 |
148 | 507 | ... directives.publication_class(WebServiceTestPublication) | 506 | ... directives.publication_class(WebServiceTestPublication) |
149 | 508 | 507 | ||
150 | === modified file 'src/lazr/restful/example/base/root.py' | |||
151 | --- src/lazr/restful/example/base/root.py 2010-01-04 21:45:14 +0000 | |||
152 | +++ src/lazr/restful/example/base/root.py 2010-02-11 18:16:16 +0000 | |||
153 | @@ -64,14 +64,14 @@ | |||
154 | 64 | def alias_url(self): | 64 | def alias_url(self): |
155 | 65 | """The URL to the managed file. | 65 | """The URL to the managed file. |
156 | 66 | 66 | ||
158 | 67 | This URL will always contain the latest_version_uri_prefix, no | 67 | This URL will always contain the name of the latest version, no |
159 | 68 | matter the version of the original request. This is not ideal, | 68 | matter the version of the original request. This is not ideal, |
160 | 69 | but it's acceptable because 1) this is just a test | 69 | but it's acceptable because 1) this is just a test |
161 | 70 | implementation, and 2) the ByteStorage implementation cannot | 70 | implementation, and 2) the ByteStorage implementation cannot |
162 | 71 | change between versions. | 71 | change between versions. |
163 | 72 | """ | 72 | """ |
164 | 73 | return 'http://cookbooks.dev/%s/filemanager/%s' % ( | 73 | return 'http://cookbooks.dev/%s/filemanager/%s' % ( |
166 | 74 | getUtility(IWebServiceConfiguration).latest_version_uri_prefix, | 74 | getUtility(IWebServiceConfiguration).active_versions[-1], |
167 | 75 | self.id) | 75 | self.id) |
168 | 76 | 76 | ||
169 | 77 | def createStored(self, mediaType, representation, filename=None): | 77 | def createStored(self, mediaType, representation, filename=None): |
170 | @@ -388,7 +388,7 @@ | |||
171 | 388 | default_batch_size=5 | 388 | default_batch_size=5 |
172 | 389 | hostname='cookbooks.dev' | 389 | hostname='cookbooks.dev' |
173 | 390 | match_batch_size=50 | 390 | match_batch_size=50 |
175 | 391 | active_versions=['1.0'] | 391 | active_versions=['1.0', 'devel'] |
176 | 392 | use_https=False | 392 | use_https=False |
177 | 393 | view_permission='lazr.restful.example.base.View' | 393 | view_permission='lazr.restful.example.base.View' |
178 | 394 | 394 | ||
179 | 395 | 395 | ||
180 | === modified file 'src/lazr/restful/example/base/tests/field.txt' | |||
181 | --- src/lazr/restful/example/base/tests/field.txt 2009-09-25 13:36:31 +0000 | |||
182 | +++ src/lazr/restful/example/base/tests/field.txt 2010-02-11 18:16:16 +0000 | |||
183 | @@ -61,7 +61,7 @@ | |||
184 | 61 | Content-Type: application/json | 61 | Content-Type: application/json |
185 | 62 | ... | 62 | ... |
186 | 63 | <BLANKLINE> | 63 | <BLANKLINE> |
188 | 64 | "http://cookbooks.dev/1.0/cookbooks/The%20Joy%20of%20Cooking" | 64 | "http://cookbooks.dev/.../cookbooks/The%20Joy%20of%20Cooking" |
189 | 65 | 65 | ||
190 | 66 | The same rules for modifying a field apply whether you're modifying | 66 | The same rules for modifying a field apply whether you're modifying |
191 | 67 | the entry as a whole or just modifying a single field. | 67 | the entry as a whole or just modifying a single field. |
192 | 68 | 68 | ||
193 | === modified file 'src/lazr/restful/example/base/tests/root.txt' | |||
194 | --- src/lazr/restful/example/base/tests/root.txt 2009-11-12 16:30:50 +0000 | |||
195 | +++ src/lazr/restful/example/base/tests/root.txt 2010-02-11 18:16:16 +0000 | |||
196 | @@ -15,10 +15,10 @@ | |||
197 | 15 | u'featured_cookbook_link', u'recipes_collection_link', | 15 | u'featured_cookbook_link', u'recipes_collection_link', |
198 | 16 | u'resource_type_link'] | 16 | u'resource_type_link'] |
199 | 17 | >>> top_level_links['cookbooks_collection_link'] | 17 | >>> top_level_links['cookbooks_collection_link'] |
201 | 18 | u'http://cookbooks.dev/1.0/cookbooks' | 18 | u'http://cookbooks.dev/devel/cookbooks' |
202 | 19 | 19 | ||
203 | 20 | >>> print top_level_links['resource_type_link'] | 20 | >>> print top_level_links['resource_type_link'] |
205 | 21 | http://cookbooks.dev/1.0/#service-root | 21 | http://cookbooks.dev/devel/#service-root |
206 | 22 | 22 | ||
207 | 23 | The client can explore the entire web service by following these links | 23 | The client can explore the entire web service by following these links |
208 | 24 | to other resources, and following the links served in those resources' | 24 | to other resources, and following the links served in those resources' |
209 | 25 | 25 | ||
210 | === modified file 'src/lazr/restful/example/base/tests/wadl.txt' | |||
211 | --- src/lazr/restful/example/base/tests/wadl.txt 2009-10-21 14:10:49 +0000 | |||
212 | +++ src/lazr/restful/example/base/tests/wadl.txt 2010-02-11 18:16:16 +0000 | |||
213 | @@ -381,7 +381,7 @@ | |||
214 | 381 | >>> resources.tag | 381 | >>> resources.tag |
215 | 382 | '...resources' | 382 | '...resources' |
216 | 383 | >>> print resources.attrib['base'] | 383 | >>> print resources.attrib['base'] |
218 | 384 | http://cookbooks.dev/1.0/ | 384 | http://cookbooks.dev/devel/ |
219 | 385 | 385 | ||
220 | 386 | As with the <resources> tags shown earlier, this one contains a single | 386 | As with the <resources> tags shown earlier, this one contains a single |
221 | 387 | <resource> tag. | 387 | <resource> tag. |
222 | 388 | 388 | ||
223 | === modified file 'src/lazr/restful/example/multiversion/root.py' | |||
224 | --- src/lazr/restful/example/multiversion/root.py 2010-02-08 18:24:57 +0000 | |||
225 | +++ src/lazr/restful/example/multiversion/root.py 2010-02-11 18:16:16 +0000 | |||
226 | @@ -34,8 +34,7 @@ | |||
227 | 34 | 34 | ||
228 | 35 | class WebServiceConfiguration(BaseWSGIWebServiceConfiguration): | 35 | class WebServiceConfiguration(BaseWSGIWebServiceConfiguration): |
229 | 36 | code_revision = '1' | 36 | code_revision = '1' |
232 | 37 | active_versions = ['beta', '1.0', '2.0', '3.0'] | 37 | active_versions = ['beta', '1.0', '2.0', '3.0', 'trunk'] |
231 | 38 | latest_version_uri_prefix = 'trunk' | ||
233 | 39 | use_https = False | 38 | use_https = False |
234 | 40 | view_permission = 'zope.Public' | 39 | view_permission = 'zope.Public' |
235 | 41 | 40 | ||
236 | 42 | 41 | ||
237 | === modified file 'src/lazr/restful/interfaces/_rest.py' | |||
238 | --- src/lazr/restful/interfaces/_rest.py 2010-02-11 16:32:17 +0000 | |||
239 | +++ src/lazr/restful/interfaces/_rest.py 2010-02-11 18:16:16 +0000 | |||
240 | @@ -441,26 +441,12 @@ | |||
241 | 441 | "beta", or the date a particular version was finalized. | 441 | "beta", or the date a particular version was finalized. |
242 | 442 | 442 | ||
243 | 443 | Newer versions should show up later in the list than earlier | 443 | Newer versions should show up later in the list than earlier |
264 | 444 | versions. The most recent active version should be at the end | 444 | versions. It's recommended that the last version, located at |
265 | 445 | of the list. | 445 | the end of the list, be a floating development version called |
266 | 446 | 446 | something like 'trunk' or 'devel': effectively an alias for | |
267 | 447 | Currently this list must contain at least one version name.""") | 447 | "the most up-to-date code". |
268 | 448 | 448 | ||
269 | 449 | # XXX 2010-02-11 leonardr bug=520542: The latest version should | 449 | This list must contain at least one version name.""") |
250 | 450 | # simply be the last version in active_versions. | ||
251 | 451 | latest_version_uri_prefix = TextLine( | ||
252 | 452 | default=u"devel", | ||
253 | 453 | description=u"""A string naming the alias for the "development" | ||
254 | 454 | version of a multi-versioned web service. This version may | ||
255 | 455 | have features not present in older versions, and may be | ||
256 | 456 | backwards incompatible with those services, but it is not | ||
257 | 457 | necessarily the same as any released version. If you do not | ||
258 | 458 | publish a multi-versioned web service, just use the default. | ||
259 | 459 | |||
260 | 460 | latest_version_uri_prefix shows up in the same place as any | ||
261 | 461 | other version URI prefix: after any value for | ||
262 | 462 | service_root_uri_prefix. | ||
263 | 463 | """) | ||
270 | 464 | 450 | ||
271 | 465 | code_revision = TextLine( | 451 | code_revision = TextLine( |
272 | 466 | default=u"", | 452 | default=u"", |
273 | 467 | 453 | ||
274 | === modified file 'src/lazr/restful/metazcml.py' | |||
275 | --- src/lazr/restful/metazcml.py 2010-02-03 17:40:54 +0000 | |||
276 | +++ src/lazr/restful/metazcml.py 2010-02-11 18:16:16 +0000 | |||
277 | @@ -46,8 +46,6 @@ | |||
278 | 46 | # Get the list of versions. | 46 | # Get the list of versions. |
279 | 47 | config = getUtility(IWebServiceConfiguration) | 47 | config = getUtility(IWebServiceConfiguration) |
280 | 48 | versions = list(config.active_versions) | 48 | versions = list(config.active_versions) |
281 | 49 | if config.latest_version_uri_prefix not in versions: | ||
282 | 50 | versions += [config.latest_version_uri_prefix] | ||
283 | 51 | 49 | ||
284 | 52 | # Generate an interface and an adapter for every version. | 50 | # Generate an interface and an adapter for every version. |
285 | 53 | web_interfaces = generate_entry_interfaces(interface, *versions) | 51 | web_interfaces = generate_entry_interfaces(interface, *versions) |
286 | @@ -86,8 +84,7 @@ | |||
287 | 86 | versions. | 84 | versions. |
288 | 87 | """ | 85 | """ |
289 | 88 | configuration = getUtility(IWebServiceConfiguration) | 86 | configuration = getUtility(IWebServiceConfiguration) |
292 | 89 | actual_versions = configuration.active_versions + [ | 87 | actual_versions = configuration.active_versions |
291 | 90 | configuration.latest_version_uri_prefix] | ||
293 | 91 | # Replace None with the actual version number of the earliest | 88 | # Replace None with the actual version number of the earliest |
294 | 92 | # version. | 89 | # version. |
295 | 93 | try: | 90 | try: |
296 | 94 | 91 | ||
297 | === modified file 'src/lazr/restful/publisher.py' | |||
298 | --- src/lazr/restful/publisher.py 2010-01-11 18:27:43 +0000 | |||
299 | +++ src/lazr/restful/publisher.py 2010-02-11 18:16:16 +0000 | |||
300 | @@ -241,12 +241,10 @@ | |||
301 | 241 | # optimizations later in the request lifecycle. | 241 | # optimizations later in the request lifecycle. |
302 | 242 | alsoProvides(self, IWebBrowserInitiatedRequest) | 242 | alsoProvides(self, IWebBrowserInitiatedRequest) |
303 | 243 | 243 | ||
306 | 244 | # Only accept versioned URLs. Either the | 244 | # Only accept versioned URLs. Any of the active_versions is |
305 | 245 | # latest_version_uri_prefix or one of the active_versions is | ||
307 | 246 | # acceptable. | 245 | # acceptable. |
308 | 247 | version = None | 246 | version = None |
311 | 248 | for version_string in ( | 247 | for version_string in config.active_versions: |
310 | 249 | config.active_versions + [config.latest_version_uri_prefix]): | ||
312 | 250 | if version_string is not None: | 248 | if version_string is not None: |
313 | 251 | version = self._popTraversal(version_string) | 249 | version = self._popTraversal(version_string) |
314 | 252 | if version is not None: | 250 | if version is not None: |
315 | 253 | 251 | ||
316 | === modified file 'src/lazr/restful/testing/webservice.py' | |||
317 | --- src/lazr/restful/testing/webservice.py 2010-02-03 16:19:03 +0000 | |||
318 | +++ src/lazr/restful/testing/webservice.py 2010-02-11 18:16:16 +0000 | |||
319 | @@ -107,7 +107,7 @@ | |||
320 | 107 | def __init__(self, traversed=None, stack=None, version=None): | 107 | def __init__(self, traversed=None, stack=None, version=None): |
321 | 108 | if version is None: | 108 | if version is None: |
322 | 109 | config = getUtility(IWebServiceConfiguration) | 109 | config = getUtility(IWebServiceConfiguration) |
324 | 110 | version = config.latest_version_uri_prefix | 110 | version = config.active_versions[-1] |
325 | 111 | self.version = version | 111 | self.version = version |
326 | 112 | self._traversed_names = traversed | 112 | self._traversed_names = traversed |
327 | 113 | self._stack = stack | 113 | self._stack = stack |
328 | 114 | 114 | ||
329 | === modified file 'src/lazr/restful/tests/test_webservice.py' | |||
330 | --- src/lazr/restful/tests/test_webservice.py 2010-02-01 16:08:58 +0000 | |||
331 | +++ src/lazr/restful/tests/test_webservice.py 2010-02-11 18:16:16 +0000 | |||
332 | @@ -98,7 +98,7 @@ | |||
333 | 98 | class SimpleWebServiceConfiguration(BaseWebServiceConfiguration): | 98 | class SimpleWebServiceConfiguration(BaseWebServiceConfiguration): |
334 | 99 | implements(IWebServiceConfiguration) | 99 | implements(IWebServiceConfiguration) |
335 | 100 | show_tracebacks = False | 100 | show_tracebacks = False |
337 | 101 | latest_version_uri_prefix = 'trunk' | 101 | active_versions = ['trunk'] |
338 | 102 | hostname = "webservice_test" | 102 | hostname = "webservice_test" |
339 | 103 | 103 | ||
340 | 104 | def createRequest(self, body_instream, environ): | 104 | def createRequest(self, body_instream, environ): |
This branch fixes bug 520542, removing the confusing "latest_ version_ uri_prefix" attribute from IWebServiceConf iguration and everywhere else. Now there is a single list of active_versions and if you want to have a floating dev version, it can go on the end of the active_versions list.
The changes to the tests happen because FakeRequest (used by the tests) by default made a request to the last version mentioned in active_versions, *not* the most recent version period. When 'devel' was in latest_ version_ uri_prefix, the last version mentioned in active_versions was '1.0'. Now it's 'devel', so some of the URLs in tests changed.