/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transport/ftp.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-26 13:16:59 UTC
  • mfrom: (1959.1.1 bzr.dev)
  • mto: This revision was merged to the branch mainline in revision 1960.
  • Revision ID: john@arbash-meinel.com-20060826131659-140bcaf758134ed2
[merge] Marien Zwart: Updates for newer diffutils.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
import random
38
38
from warnings import warn
39
39
 
 
40
from bzrlib import (
 
41
    errors,
 
42
    urlutils,
 
43
    )
 
44
from bzrlib.trace import mutter, warning
40
45
from bzrlib.transport import (
41
 
    Transport,
42
46
    Server,
43
47
    split_url,
 
48
    Transport,
44
49
    )
45
 
import bzrlib.errors as errors
46
 
from bzrlib.trace import mutter, warning
47
50
import bzrlib.ui
48
51
 
49
52
_have_medusa = False
122
125
            netloc = '%s@%s' % (urllib.quote(self._username), netloc)
123
126
        if self._port is not None:
124
127
            netloc = '%s:%d' % (netloc, self._port)
125
 
        return urlparse.urlunparse(('ftp', netloc, path, '', '', ''))
 
128
        proto = 'ftp'
 
129
        if self.is_active:
 
130
            proto = 'aftp'
 
131
        return urlparse.urlunparse((proto, netloc, path, '', '', ''))
126
132
 
127
133
    def _get_FTP(self):
128
134
        """Return the ftplib.FTP instance for this object."""
189
195
 
190
196
    def _abspath(self, relpath):
191
197
        assert isinstance(relpath, basestring)
192
 
        relpath = urllib.unquote(relpath)
 
198
        relpath = urlutils.unescape(relpath)
193
199
        relpath_parts = relpath.split('/')
194
200
        if len(relpath_parts) > 1:
195
201
            if relpath_parts[0] == '':
212
218
        # Possibly, we could use urlparse.urljoin() here, but
213
219
        # I'm concerned about when it chooses to strip the last
214
220
        # portion of the path, and when it doesn't.
215
 
        return '/'.join(basepath) or '/'
 
221
 
 
222
        # XXX: It seems that ftplib does not handle Unicode paths
 
223
        # at the same time, medusa won't handle utf8 paths
 
224
        # So if we .encode(utf8) here, then we get a Server failure.
 
225
        # while if we use str(), we get a UnicodeError, and the test suite
 
226
        # just skips testing UnicodePaths.
 
227
        return str('/'.join(basepath) or '/')
216
228
    
217
229
    def abspath(self, relpath):
218
230
        """Return the full url to the given relative path.