Merge lp:~cjwatson/lazr.restful/six-urllib into lp:lazr.restful
- six-urllib
- Merge into trunk
Proposed by
Colin Watson
Status: | Merged |
---|---|
Merged at revision: | 235 |
Proposed branch: | lp:~cjwatson/lazr.restful/six-urllib |
Merge into: | lp:lazr.restful |
Diff against target: |
338 lines (+37/-33) 16 files modified
src/lazr/restful/docs/multiversion.rst (+1/-1) src/lazr/restful/docs/webservice-declarations.rst (+1/-1) src/lazr/restful/docs/webservice.rst (+2/-3) src/lazr/restful/example/base/tests/collection.txt (+1/-2) src/lazr/restful/example/base/tests/entry.txt (+1/-1) src/lazr/restful/example/base/tests/field.txt (+1/-1) src/lazr/restful/example/base/tests/hostedfile.txt (+1/-1) src/lazr/restful/example/base/tests/representation-cache.txt (+1/-1) src/lazr/restful/example/base/tests/service.txt (+1/-1) src/lazr/restful/example/base/tests/wadl.txt (+1/-1) src/lazr/restful/example/base/traversal.py (+1/-1) src/lazr/restful/marshallers.py (+2/-2) src/lazr/restful/publisher.py (+8/-7) src/lazr/restful/simple.py (+6/-4) src/lazr/restful/tales.py (+2/-2) src/lazr/restful/testing/webservice.py (+7/-4) |
To merge this branch: | bzr merge lp:~cjwatson/lazr.restful/six-urllib |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ioana Lasc (community) | Approve | ||
LAZR Developers | Pending | ||
Review via email: mp+378515@code.launchpad.net |
Commit message
Import urllib and friends from six.moves.
Description of the change
This part of the standard library was rearranged in Python 3.
To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) : | # |
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/docs/multiversion.rst' | |||
2 | --- src/lazr/restful/docs/multiversion.rst 2020-02-04 11:52:59 +0000 | |||
3 | +++ src/lazr/restful/docs/multiversion.rst 2020-02-04 13:19:13 +0000 | |||
4 | @@ -163,7 +163,7 @@ | |||
5 | 163 | 163 | ||
6 | 164 | Here's a simple implementation of IContact. | 164 | Here's a simple implementation of IContact. |
7 | 165 | 165 | ||
9 | 166 | >>> from urllib import quote | 166 | >>> from six.moves.urllib.parse import quote |
10 | 167 | >>> from zope.interface import implementer | 167 | >>> from zope.interface import implementer |
11 | 168 | >>> from lazr.restful.security import protect_schema | 168 | >>> from lazr.restful.security import protect_schema |
12 | 169 | >>> @implementer(IContact, ILocation) | 169 | >>> @implementer(IContact, ILocation) |
13 | 170 | 170 | ||
14 | === modified file 'src/lazr/restful/docs/webservice-declarations.rst' | |||
15 | --- src/lazr/restful/docs/webservice-declarations.rst 2020-02-04 11:52:59 +0000 | |||
16 | +++ src/lazr/restful/docs/webservice-declarations.rst 2020-02-04 13:19:13 +0000 | |||
17 | @@ -1291,7 +1291,7 @@ | |||
18 | 1291 | (For the URL generation to work, we need to register an IAbsoluteURL | 1291 | (For the URL generation to work, we need to register an IAbsoluteURL |
19 | 1292 | adapter and set the request as the current interaction.) | 1292 | adapter and set the request as the current interaction.) |
20 | 1293 | 1293 | ||
22 | 1294 | >>> from urllib import quote | 1294 | >>> from six.moves.urllib.parse import quote |
23 | 1295 | >>> from zope.component import provideAdapter | 1295 | >>> from zope.component import provideAdapter |
24 | 1296 | >>> from zope.traversing.browser.interfaces import IAbsoluteURL | 1296 | >>> from zope.traversing.browser.interfaces import IAbsoluteURL |
25 | 1297 | >>> from zope.publisher.interfaces.http import IHTTPApplicationRequest | 1297 | >>> from zope.publisher.interfaces.http import IHTTPApplicationRequest |
26 | 1298 | 1298 | ||
27 | === modified file 'src/lazr/restful/docs/webservice.rst' | |||
28 | --- src/lazr/restful/docs/webservice.rst 2020-02-04 11:52:59 +0000 | |||
29 | +++ src/lazr/restful/docs/webservice.rst 2020-02-04 13:19:13 +0000 | |||
30 | @@ -114,7 +114,7 @@ | |||
31 | 114 | interface. | 114 | interface. |
32 | 115 | 115 | ||
33 | 116 | 116 | ||
35 | 117 | >>> from urllib import quote | 117 | >>> from six.moves.urllib.parse import quote |
36 | 118 | >>> from zope.component import ( | 118 | >>> from zope.component import ( |
37 | 119 | ... adapter, getSiteManager, getMultiAdapter) | 119 | ... adapter, getSiteManager, getMultiAdapter) |
38 | 120 | >>> from zope.interface import implementer | 120 | >>> from zope.interface import implementer |
39 | @@ -201,7 +201,7 @@ | |||
40 | 201 | 201 | ||
41 | 202 | >>> protect_schema(Cookbook, ICookbook, write_permission=CheckerPublic) | 202 | >>> protect_schema(Cookbook, ICookbook, write_permission=CheckerPublic) |
42 | 203 | 203 | ||
44 | 204 | >>> from urllib import unquote | 204 | >>> from six.moves.urllib.parse import unquote |
45 | 205 | >>> @implementer(IPublishTraverse) | 205 | >>> @implementer(IPublishTraverse) |
46 | 206 | ... @adapter(ICookbook, IBrowserRequest) | 206 | ... @adapter(ICookbook, IBrowserRequest) |
47 | 207 | ... class CookbookTraversal: | 207 | ... class CookbookTraversal: |
48 | @@ -2090,7 +2090,6 @@ | |||
49 | 2090 | activate that operation and delete the entry by sending a DELETE | 2090 | activate that operation and delete the entry by sending a DELETE |
50 | 2091 | request. | 2091 | request. |
51 | 2092 | 2092 | ||
52 | 2093 | >>> from urllib import quote | ||
53 | 2094 | >>> recipe_url = quote('/beta/cookbooks/Mastering the Art of ' | 2093 | >>> recipe_url = quote('/beta/cookbooks/Mastering the Art of ' |
54 | 2095 | ... 'French Cooking/recipes/Foies de voilaille en aspic') | 2094 | ... 'French Cooking/recipes/Foies de voilaille en aspic') |
55 | 2096 | 2095 | ||
56 | 2097 | 2096 | ||
57 | === modified file 'src/lazr/restful/example/base/tests/collection.txt' | |||
58 | --- src/lazr/restful/example/base/tests/collection.txt 2020-02-04 11:52:59 +0000 | |||
59 | +++ src/lazr/restful/example/base/tests/collection.txt 2020-02-04 13:19:13 +0000 | |||
60 | @@ -85,7 +85,7 @@ | |||
61 | 85 | 85 | ||
62 | 86 | A collection may be empty. | 86 | A collection may be empty. |
63 | 87 | 87 | ||
65 | 88 | >>> from urllib import quote | 88 | >>> from six.moves.urllib.parse import quote |
66 | 89 | >>> url = quote("/cookbooks/Cooking Without Recipes/recipes") | 89 | >>> url = quote("/cookbooks/Cooking Without Recipes/recipes") |
67 | 90 | >>> result = webservice.get(url) | 90 | >>> result = webservice.get(url) |
68 | 91 | >>> list(result.jsonBody()['entries']) | 91 | >>> list(result.jsonBody()['entries']) |
69 | @@ -99,7 +99,6 @@ | |||
70 | 99 | them has been marked private. The private one is hidden from view in | 99 | them has been marked private. The private one is hidden from view in |
71 | 100 | collections. | 100 | collections. |
72 | 101 | 101 | ||
73 | 102 | >>> from urllib import quote | ||
74 | 103 | >>> url = quote("/cookbooks/James Beard's American Cookery/recipes") | 102 | >>> url = quote("/cookbooks/James Beard's American Cookery/recipes") |
75 | 104 | >>> output = webservice.get(url).jsonBody() | 103 | >>> output = webservice.get(url).jsonBody() |
76 | 105 | >>> output['total_size'] | 104 | >>> output['total_size'] |
77 | 106 | 105 | ||
78 | === modified file 'src/lazr/restful/example/base/tests/entry.txt' | |||
79 | --- src/lazr/restful/example/base/tests/entry.txt 2020-02-04 11:52:59 +0000 | |||
80 | +++ src/lazr/restful/example/base/tests/entry.txt 2020-02-04 13:19:13 +0000 | |||
81 | @@ -22,7 +22,7 @@ | |||
82 | 22 | 22 | ||
83 | 23 | Here we see that the cookbook 'Everyday Greens' is a vegetarian cookbook. | 23 | Here we see that the cookbook 'Everyday Greens' is a vegetarian cookbook. |
84 | 24 | 24 | ||
86 | 25 | >>> from urllib import quote | 25 | >>> from six.moves.urllib.parse import quote |
87 | 26 | >>> greens_url = quote("/cookbooks/Everyday Greens") | 26 | >>> greens_url = quote("/cookbooks/Everyday Greens") |
88 | 27 | >>> webservice.get(greens_url).jsonBody()['cuisine'] | 27 | >>> webservice.get(greens_url).jsonBody()['cuisine'] |
89 | 28 | u'Vegetarian' | 28 | u'Vegetarian' |
90 | 29 | 29 | ||
91 | === modified file 'src/lazr/restful/example/base/tests/field.txt' | |||
92 | --- src/lazr/restful/example/base/tests/field.txt 2020-02-04 11:52:59 +0000 | |||
93 | +++ src/lazr/restful/example/base/tests/field.txt 2020-02-04 13:19:13 +0000 | |||
94 | @@ -8,7 +8,7 @@ | |||
95 | 8 | >>> from lazr.restful.testing.webservice import WebServiceCaller | 8 | >>> from lazr.restful.testing.webservice import WebServiceCaller |
96 | 9 | >>> webservice = WebServiceCaller(domain='cookbooks.dev') | 9 | >>> webservice = WebServiceCaller(domain='cookbooks.dev') |
97 | 10 | 10 | ||
99 | 11 | >>> from urllib import quote | 11 | >>> from six.moves.urllib.parse import quote |
100 | 12 | >>> cookbook_url = quote("/cookbooks/The Joy of Cooking") | 12 | >>> cookbook_url = quote("/cookbooks/The Joy of Cooking") |
101 | 13 | >>> field_url = cookbook_url + "/description" | 13 | >>> field_url = cookbook_url + "/description" |
102 | 14 | 14 | ||
103 | 15 | 15 | ||
104 | === modified file 'src/lazr/restful/example/base/tests/hostedfile.txt' | |||
105 | --- src/lazr/restful/example/base/tests/hostedfile.txt 2020-02-04 11:52:59 +0000 | |||
106 | +++ src/lazr/restful/example/base/tests/hostedfile.txt 2020-02-04 13:19:13 +0000 | |||
107 | @@ -15,7 +15,7 @@ | |||
108 | 15 | 15 | ||
109 | 16 | A cookbook starts out with a link to a cover image, but no actual cover. | 16 | A cookbook starts out with a link to a cover image, but no actual cover. |
110 | 17 | 17 | ||
112 | 18 | >>> from urllib import quote | 18 | >>> from six.moves.urllib.parse import quote |
113 | 19 | >>> greens_url = quote("/cookbooks/Everyday Greens") | 19 | >>> greens_url = quote("/cookbooks/Everyday Greens") |
114 | 20 | >>> greens = webservice.get(greens_url).jsonBody() | 20 | >>> greens = webservice.get(greens_url).jsonBody() |
115 | 21 | >>> greens['cover_link'] | 21 | >>> greens['cover_link'] |
116 | 22 | 22 | ||
117 | === modified file 'src/lazr/restful/example/base/tests/representation-cache.txt' | |||
118 | --- src/lazr/restful/example/base/tests/representation-cache.txt 2020-02-04 11:52:59 +0000 | |||
119 | +++ src/lazr/restful/example/base/tests/representation-cache.txt 2020-02-04 13:19:13 +0000 | |||
120 | @@ -209,7 +209,7 @@ | |||
121 | 209 | >>> print(dictionary.keys()[0]) | 209 | >>> print(dictionary.keys()[0]) |
122 | 210 | http://.../devel/cookbooks/Everyday%20Greens,application/json | 210 | http://.../devel/cookbooks/Everyday%20Greens,application/json |
123 | 211 | 211 | ||
125 | 212 | >>> from urllib import quote | 212 | >>> from six.moves.urllib.parse import quote |
126 | 213 | >>> greens_url = quote("/cookbooks/Everyday Greens") | 213 | >>> greens_url = quote("/cookbooks/Everyday Greens") |
127 | 214 | >>> ignore = webservice.named_post( | 214 | >>> ignore = webservice.named_post( |
128 | 215 | ... greens_url, "replace_cover", cover="foo") | 215 | ... greens_url, "replace_cover", cover="foo") |
129 | 216 | 216 | ||
130 | === modified file 'src/lazr/restful/example/base/tests/service.txt' | |||
131 | --- src/lazr/restful/example/base/tests/service.txt 2020-02-04 11:52:59 +0000 | |||
132 | +++ src/lazr/restful/example/base/tests/service.txt 2020-02-04 13:19:13 +0000 | |||
133 | @@ -59,7 +59,7 @@ | |||
134 | 59 | Allow: GET POST | 59 | Allow: GET POST |
135 | 60 | ... | 60 | ... |
136 | 61 | 61 | ||
138 | 62 | >>> from urllib import quote | 62 | >>> from six.moves.urllib.parse import quote |
139 | 63 | >>> print(webservice.delete(quote("/dishes/Roast chicken"))) | 63 | >>> print(webservice.delete(quote("/dishes/Roast chicken"))) |
140 | 64 | HTTP/1.1 405 Method Not Allowed... | 64 | HTTP/1.1 405 Method Not Allowed... |
141 | 65 | Allow: GET PUT PATCH | 65 | Allow: GET PUT PATCH |
142 | 66 | 66 | ||
143 | === modified file 'src/lazr/restful/example/base/tests/wadl.txt' | |||
144 | --- src/lazr/restful/example/base/tests/wadl.txt 2020-02-04 11:52:59 +0000 | |||
145 | +++ src/lazr/restful/example/base/tests/wadl.txt 2020-02-04 13:19:13 +0000 | |||
146 | @@ -12,7 +12,7 @@ | |||
147 | 12 | Let's get a WADL representation of an entry resource (in this case, a | 12 | Let's get a WADL representation of an entry resource (in this case, a |
148 | 13 | cookbook), and see what's inside. | 13 | cookbook), and see what's inside. |
149 | 14 | 14 | ||
151 | 15 | >>> from urllib import quote | 15 | >>> from six.moves.urllib.parse import quote |
152 | 16 | >>> from lazr.restful.testing.webservice import WebServiceCaller | 16 | >>> from lazr.restful.testing.webservice import WebServiceCaller |
153 | 17 | >>> webservice = WebServiceCaller(domain='cookbooks.dev') | 17 | >>> webservice = WebServiceCaller(domain='cookbooks.dev') |
154 | 18 | >>> entry_url = quote("/cookbooks/The Joy of Cooking") | 18 | >>> entry_url = quote("/cookbooks/The Joy of Cooking") |
155 | 19 | 19 | ||
156 | === modified file 'src/lazr/restful/example/base/traversal.py' | |||
157 | --- src/lazr/restful/example/base/traversal.py 2020-02-04 11:52:59 +0000 | |||
158 | +++ src/lazr/restful/example/base/traversal.py 2020-02-04 13:19:13 +0000 | |||
159 | @@ -13,7 +13,7 @@ | |||
160 | 13 | ] | 13 | ] |
161 | 14 | 14 | ||
162 | 15 | 15 | ||
164 | 16 | from urllib import unquote | 16 | from six.moves.urllib.parse import unquote |
165 | 17 | from zope.publisher.interfaces import IPublishTraverse, NotFound | 17 | from zope.publisher.interfaces import IPublishTraverse, NotFound |
166 | 18 | from zope.publisher.interfaces.browser import IDefaultBrowserLayer | 18 | from zope.publisher.interfaces.browser import IDefaultBrowserLayer |
167 | 19 | from zope.traversing.browser import absoluteURL, AbsoluteURL | 19 | from zope.traversing.browser import absoluteURL, AbsoluteURL |
168 | 20 | 20 | ||
169 | === modified file 'src/lazr/restful/marshallers.py' | |||
170 | --- src/lazr/restful/marshallers.py 2020-02-04 11:52:59 +0000 | |||
171 | +++ src/lazr/restful/marshallers.py 2020-02-04 13:19:13 +0000 | |||
172 | @@ -27,9 +27,9 @@ | |||
173 | 27 | from datetime import datetime | 27 | from datetime import datetime |
174 | 28 | import pytz | 28 | import pytz |
175 | 29 | from StringIO import StringIO | 29 | from StringIO import StringIO |
176 | 30 | import urllib | ||
177 | 31 | 30 | ||
178 | 32 | import simplejson | 31 | import simplejson |
179 | 32 | from six.moves.urllib.parse import unquote | ||
180 | 33 | 33 | ||
181 | 34 | from zope.datetime import ( | 34 | from zope.datetime import ( |
182 | 35 | DateTimeError, | 35 | DateTimeError, |
183 | @@ -113,7 +113,7 @@ | |||
184 | 113 | or fragment is not None): | 113 | or fragment is not None): |
185 | 114 | raise NotFound(self, url, self.request) | 114 | raise NotFound(self, url, self.request) |
186 | 115 | 115 | ||
188 | 116 | path_parts = [urllib.unquote(part) for part in path.split('/')] | 116 | path_parts = [unquote(part) for part in path.split('/')] |
189 | 117 | path_parts.pop(0) | 117 | path_parts.pop(0) |
190 | 118 | path_parts.reverse() | 118 | path_parts.reverse() |
191 | 119 | request = config.createRequest(StringIO(), {'PATH_INFO': path}) | 119 | request = config.createRequest(StringIO(), {'PATH_INFO': path}) |
192 | 120 | 120 | ||
193 | === modified file 'src/lazr/restful/publisher.py' | |||
194 | --- src/lazr/restful/publisher.py 2020-02-04 11:52:59 +0000 | |||
195 | +++ src/lazr/restful/publisher.py 2020-02-04 13:19:13 +0000 | |||
196 | @@ -17,9 +17,11 @@ | |||
197 | 17 | 17 | ||
198 | 18 | 18 | ||
199 | 19 | import simplejson | 19 | import simplejson |
203 | 20 | import urllib | 20 | from six.moves.urllib.parse import ( |
204 | 21 | import urlparse | 21 | quote, |
205 | 22 | 22 | urlsplit, | |
206 | 23 | urlunsplit, | ||
207 | 24 | ) | ||
208 | 23 | from zope.component import ( | 25 | from zope.component import ( |
209 | 24 | adapter, | 26 | adapter, |
210 | 25 | getMultiAdapter, | 27 | getMultiAdapter, |
211 | @@ -229,20 +231,19 @@ | |||
212 | 229 | location = request.response.getHeader("Location", None) | 231 | location = request.response.getHeader("Location", None) |
213 | 230 | if location is not None: | 232 | if location is not None: |
214 | 231 | accept = request.getHeader("Accept", "application/json") | 233 | accept = request.getHeader("Accept", "application/json") |
216 | 232 | qs_append = "ws.accept=" + urllib.quote(accept) | 234 | qs_append = "ws.accept=" + quote(accept) |
217 | 233 | # We don't use the URI class because it will raise | 235 | # We don't use the URI class because it will raise |
218 | 234 | # an exception if the Location contains invalid | 236 | # an exception if the Location contains invalid |
219 | 235 | # characters. Invalid characters may indeed be a | 237 | # characters. Invalid characters may indeed be a |
220 | 236 | # problem, but let the problem be handled | 238 | # problem, but let the problem be handled |
221 | 237 | # somewhere else. | 239 | # somewhere else. |
222 | 238 | (scheme, netloc, path, query, fragment) = ( | 240 | (scheme, netloc, path, query, fragment) = ( |
224 | 239 | urlparse.urlsplit(location)) | 241 | urlsplit(location)) |
225 | 240 | if query == '': | 242 | if query == '': |
226 | 241 | query = qs_append | 243 | query = qs_append |
227 | 242 | else: | 244 | else: |
228 | 243 | query += '&' + qs_append | 245 | query += '&' + qs_append |
231 | 244 | uri = urlparse.urlunsplit( | 246 | uri = urlunsplit((scheme, netloc, path, query, fragment)) |
230 | 245 | (scheme, netloc, path, query, fragment)) | ||
232 | 246 | request.response.setHeader("Location", str(uri)) | 247 | request.response.setHeader("Location", str(uri)) |
233 | 247 | return value | 248 | return value |
234 | 248 | 249 | ||
235 | 249 | 250 | ||
236 | === modified file 'src/lazr/restful/simple.py' | |||
237 | --- src/lazr/restful/simple.py 2020-02-04 11:52:59 +0000 | |||
238 | +++ src/lazr/restful/simple.py 2020-02-04 13:19:13 +0000 | |||
239 | @@ -19,8 +19,11 @@ | |||
240 | 19 | ] | 19 | ] |
241 | 20 | 20 | ||
242 | 21 | import traceback | 21 | import traceback |
243 | 22 | import urllib | ||
244 | 23 | 22 | ||
245 | 23 | from six.moves.urllib.parse import ( | ||
246 | 24 | quote, | ||
247 | 25 | unquote, | ||
248 | 26 | ) | ||
249 | 24 | from zope.component import ( | 27 | from zope.component import ( |
250 | 25 | adapter, getMultiAdapter, getUtility, queryMultiAdapter) | 28 | adapter, getMultiAdapter, getUtility, queryMultiAdapter) |
251 | 26 | from zope.interface import Attribute, Interface, implementer | 29 | from zope.interface import Attribute, Interface, implementer |
252 | @@ -168,7 +171,7 @@ | |||
253 | 168 | 171 | ||
254 | 169 | def publishTraverse(self, request, name): | 172 | def publishTraverse(self, request, name): |
255 | 170 | """See `IPublishTraverse`.""" | 173 | """See `IPublishTraverse`.""" |
257 | 171 | name = urllib.unquote(name) | 174 | name = unquote(name) |
258 | 172 | value = self.get(request, name) | 175 | value = self.get(request, name) |
259 | 173 | if value is None: | 176 | if value is None: |
260 | 174 | raise NotFound(self, name) | 177 | raise NotFound(self, name) |
261 | @@ -370,8 +373,7 @@ | |||
262 | 370 | if not hasattr(parts, '__iter__'): | 373 | if not hasattr(parts, '__iter__'): |
263 | 371 | raise TypeError("Expected an iterable for __path_parts__.") | 374 | raise TypeError("Expected an iterable for __path_parts__.") |
264 | 372 | 375 | ||
267 | 373 | escaped_parts = [urllib.quote(part.encode('utf-8'), _safe) | 376 | escaped_parts = [quote(part.encode('utf-8'), _safe) for part in parts] |
266 | 374 | for part in parts] | ||
268 | 375 | return start_url + "/" + "/".join(escaped_parts) | 377 | return start_url + "/" + "/".join(escaped_parts) |
269 | 376 | __call__ = __str__ | 378 | __call__ = __str__ |
270 | 377 | 379 | ||
271 | 378 | 380 | ||
272 | === modified file 'src/lazr/restful/tales.py' | |||
273 | --- src/lazr/restful/tales.py 2020-02-04 11:52:59 +0000 | |||
274 | +++ src/lazr/restful/tales.py 2020-02-04 13:19:13 +0000 | |||
275 | @@ -11,7 +11,6 @@ | |||
276 | 11 | import operator | 11 | import operator |
277 | 12 | import simplejson | 12 | import simplejson |
278 | 13 | import textwrap | 13 | import textwrap |
279 | 14 | import urllib | ||
280 | 15 | 14 | ||
281 | 16 | from epydoc.markup import DocstringLinker | 15 | from epydoc.markup import DocstringLinker |
282 | 17 | from epydoc.markup.restructuredtext import ( | 16 | from epydoc.markup.restructuredtext import ( |
283 | @@ -22,6 +21,7 @@ | |||
284 | 22 | from docutils import io | 21 | from docutils import io |
285 | 23 | from docutils.core import Publisher | 22 | from docutils.core import Publisher |
286 | 24 | 23 | ||
287 | 24 | from six.moves.urllib.parse import quote | ||
288 | 25 | from zope.component import ( | 25 | from zope.component import ( |
289 | 26 | adapter, getGlobalSiteManager, getUtility, queryMultiAdapter) | 26 | adapter, getGlobalSiteManager, getUtility, queryMultiAdapter) |
290 | 27 | from zope.interface import implementer | 27 | from zope.interface import implementer |
291 | @@ -246,7 +246,7 @@ | |||
292 | 246 | relationship_name = self.context.relationship.__name__ | 246 | relationship_name = self.context.relationship.__name__ |
293 | 247 | return (absoluteURL(self.context.context, | 247 | return (absoluteURL(self.context.context, |
294 | 248 | get_current_web_service_request()) + '/' + | 248 | get_current_web_service_request()) + '/' + |
296 | 249 | urllib.quote(relationship_name)) | 249 | quote(relationship_name)) |
297 | 250 | else: | 250 | else: |
298 | 251 | return super(WadlCollectionResourceAPI, self).url | 251 | return super(WadlCollectionResourceAPI, self).url |
299 | 252 | 252 | ||
300 | 253 | 253 | ||
301 | === modified file 'src/lazr/restful/testing/webservice.py' | |||
302 | --- src/lazr/restful/testing/webservice.py 2020-02-04 11:52:59 +0000 | |||
303 | +++ src/lazr/restful/testing/webservice.py 2020-02-04 13:19:13 +0000 | |||
304 | @@ -25,11 +25,14 @@ | |||
305 | 25 | import sys | 25 | import sys |
306 | 26 | from types import ModuleType | 26 | from types import ModuleType |
307 | 27 | import unittest | 27 | import unittest |
308 | 28 | import urllib | ||
309 | 29 | 28 | ||
310 | 30 | from urlparse import urljoin | ||
311 | 31 | import wsgi_intercept | 29 | import wsgi_intercept |
312 | 32 | 30 | ||
313 | 31 | from six.moves.urllib.parse import ( | ||
314 | 32 | quote, | ||
315 | 33 | urlencode, | ||
316 | 34 | urljoin, | ||
317 | 35 | ) | ||
318 | 33 | from zope.component import ( | 36 | from zope.component import ( |
319 | 34 | adapter, getGlobalSiteManager, getUtility) | 37 | adapter, getGlobalSiteManager, getUtility) |
320 | 35 | from zope.configuration import xmlconfig | 38 | from zope.configuration import xmlconfig |
321 | @@ -333,7 +336,7 @@ | |||
322 | 333 | for key, value in args.items(): | 336 | for key, value in args.items(): |
323 | 334 | if not isinstance(value, basestring): | 337 | if not isinstance(value, basestring): |
324 | 335 | args[key] = simplejson.dumps(value) | 338 | args[key] = simplejson.dumps(value) |
326 | 336 | return urllib.urlencode(args) | 339 | return urlencode(args) |
327 | 337 | 340 | ||
328 | 338 | def named_get(self, path_or_url, operation_name, headers=None, | 341 | def named_get(self, path_or_url, operation_name, headers=None, |
329 | 339 | api_version=None, **kwargs): | 342 | api_version=None, **kwargs): |
330 | @@ -362,7 +365,7 @@ | |||
331 | 362 | """ | 365 | """ |
332 | 363 | if not isinstance(value, basestring): | 366 | if not isinstance(value, basestring): |
333 | 364 | value = simplejson.dumps(value) | 367 | value = simplejson.dumps(value) |
335 | 365 | return urllib.quote(value) | 368 | return quote(value) |
336 | 366 | 369 | ||
337 | 367 | def _make_request_with_entity_body(self, path, method, media_type, data, | 370 | def _make_request_with_entity_body(self, path, method, media_type, data, |
338 | 368 | headers, api_version): | 371 | headers, api_version): |