Show More
@@ -1444,6 +1444,8 b' class url(object):' | |||||
1444 | path = None |
|
1444 | path = None | |
1445 | if not self.host: |
|
1445 | if not self.host: | |
1446 | self.host = None |
|
1446 | self.host = None | |
|
1447 | # path of file:///d is /d | |||
|
1448 | # path of file:///d:/ is d:/, not /d:/ | |||
1447 | if path and not hasdriveletter(path): |
|
1449 | if path and not hasdriveletter(path): | |
1448 | path = '/' + path |
|
1450 | path = '/' + path | |
1449 |
|
1451 | |||
@@ -1586,11 +1588,6 b' class url(object):' | |||||
1586 | path = self._hostport + '/' + self.path |
|
1588 | path = self._hostport + '/' + self.path | |
1587 | elif self.host is not None and self.path: |
|
1589 | elif self.host is not None and self.path: | |
1588 | path = '/' + path |
|
1590 | path = '/' + path | |
1589 | # We also need to handle the case of file:///C:/, which |
|
|||
1590 | # should return C:/, not /C:/. |
|
|||
1591 | elif hasdriveletter(path): |
|
|||
1592 | # Strip leading slash from paths with drive names |
|
|||
1593 | return path[1:] |
|
|||
1594 | return path |
|
1591 | return path | |
1595 | return self._origpath |
|
1592 | return self._origpath | |
1596 |
|
1593 |
@@ -204,18 +204,32 b' def test_url():' | |||||
204 | <url scheme: 'file', path: '/foo/bar/baz'> |
|
204 | <url scheme: 'file', path: '/foo/bar/baz'> | |
205 | >>> str(u) |
|
205 | >>> str(u) | |
206 | 'file:///foo/bar/baz' |
|
206 | 'file:///foo/bar/baz' | |
|
207 | >>> u.localpath() | |||
|
208 | '/foo/bar/baz' | |||
207 |
|
209 | |||
208 | >>> u = url('file:///foo/bar/baz') |
|
210 | >>> u = url('file:///foo/bar/baz') | |
209 | >>> u |
|
211 | >>> u | |
210 | <url scheme: 'file', path: '/foo/bar/baz'> |
|
212 | <url scheme: 'file', path: '/foo/bar/baz'> | |
211 | >>> str(u) |
|
213 | >>> str(u) | |
212 | 'file:///foo/bar/baz' |
|
214 | 'file:///foo/bar/baz' | |
|
215 | >>> u.localpath() | |||
|
216 | '/foo/bar/baz' | |||
|
217 | ||||
|
218 | >>> u = url('file:///f:oo/bar/baz') | |||
|
219 | >>> u | |||
|
220 | <url scheme: 'file', path: 'f:oo/bar/baz'> | |||
|
221 | >>> str(u) | |||
|
222 | 'file:f%3Aoo/bar/baz' | |||
|
223 | >>> u.localpath() | |||
|
224 | 'f:oo/bar/baz' | |||
213 |
|
225 | |||
214 | >>> u = url('file:foo/bar/baz') |
|
226 | >>> u = url('file:foo/bar/baz') | |
215 | >>> u |
|
227 | >>> u | |
216 | <url scheme: 'file', path: 'foo/bar/baz'> |
|
228 | <url scheme: 'file', path: 'foo/bar/baz'> | |
217 | >>> str(u) |
|
229 | >>> str(u) | |
218 | 'file:foo/bar/baz' |
|
230 | 'file:foo/bar/baz' | |
|
231 | >>> u.localpath() | |||
|
232 | 'foo/bar/baz' | |||
219 | """ |
|
233 | """ | |
220 |
|
234 | |||
221 | doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE) |
|
235 | doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE) |
General Comments 0
You need to be logged in to leave comments.
Login now