~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2006-04-25 15:05:42 UTC
  • mfrom: (1185.85.85 bzr-encoding)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20060425150542-c7b518dca9928691
[merge] the old bzr-encoding changes, reparenting them on bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
from copy import deepcopy
32
32
from stat import *
33
33
import sys
 
34
import urllib
34
35
from unittest import TestSuite
35
36
import urllib
36
37
import urlparse
672
673
    return urllib.quote(relpath)
673
674
 
674
675
 
675
 
def urlunescape(relpath):
676
 
    """Unescape relpath from url format."""
677
 
    return urllib.unquote(relpath)
678
 
    # TODO de-utf8 it last. relpath = utf8relpath.decode('utf8')
 
676
def urlunescape(url):
 
677
    """Unescape relpath from url format.
 
678
 
 
679
    This returns a Unicode path from a URL
 
680
    """
 
681
    unquoted = urllib.unquote(url)
 
682
    try:
 
683
        unicode_path = unquoted.decode('utf-8')
 
684
    except UnicodeError, e:
 
685
        raise errors.InvalidURL(url, e)
 
686
    return unicode_path
679
687
 
680
688
 
681
689
class Server(object):