~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/urlutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-11-30 22:04:45 UTC
  • mfrom: (4789.28.4 2.1.0b4-builder-no-keys)
  • Revision ID: pqm@pqm.ubuntu.com-20091130220445-vbfmmgocbgcs195q
(jam) Update BTreeBuilder to remove ._keys and use StaticTuple

Show diffs side-by-side

added added

removed removed

Lines of Context:
217
217
# jam 20060502 Sorted to 'l' because the final target is 'local_path_from_url'
218
218
def _posix_local_path_from_url(url):
219
219
    """Convert a url like file:///path/to/foo into /path/to/foo"""
220
 
    if not url.startswith('file:///'):
221
 
        raise errors.InvalidURL(url, 'local urls must start with file:///')
 
220
    file_localhost_prefix = 'file://localhost/'
 
221
    if url.startswith(file_localhost_prefix):
 
222
        path = url[len(file_localhost_prefix) - 1:]
 
223
    elif not url.startswith('file:///'):
 
224
        raise errors.InvalidURL(
 
225
            url, 'local urls must start with file:/// or file://localhost/')
 
226
    else:
 
227
        path = url[len('file://'):]
222
228
    # We only strip off 2 slashes
223
 
    return unescape(url[len('file://'):])
 
229
    return unescape(path)
224
230
 
225
231
 
226
232
def _posix_local_path_to_url(path):