~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/ftp/__init__.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
active, in which case aftp:// will be your friend.
26
26
"""
27
27
 
 
28
from __future__ import absolute_import
 
29
 
28
30
from cStringIO import StringIO
29
31
import ftplib
30
32
import getpass
246
248
            mutter("FTP has not: %s: %s", abspath, e)
247
249
            return False
248
250
 
249
 
    def get(self, relpath, decode=DEPRECATED_PARAMETER, retries=0):
 
251
    def get(self, relpath, retries=0):
250
252
        """Get the file at the given relative path.
251
253
 
252
254
        :param relpath: The relative path to the file
256
258
        We're meant to return a file-like object which bzr will
257
259
        then read from. For now we do this via the magic of StringIO
258
260
        """
259
 
        if deprecated_passed(decode):
260
 
            warn(deprecated_in((2,3,0)) %
261
 
                 '"decode" parameter to FtpTransport.get()',
262
 
                 DeprecationWarning, stacklevel=2)
263
261
        try:
264
262
            mutter("FTP get: %s", self._remote_path(relpath))
265
263
            f = self._get_FTP()
277
275
            else:
278
276
                warning("FTP temporary error: %s. Retrying.", str(e))
279
277
                self._reconnect()
280
 
                return self.get(relpath, decode, retries+1)
 
278
                return self.get(relpath, retries+1)
281
279
        except EOFError, e:
282
280
            if retries > _number_of_retries:
283
281
                raise errors.TransportError("FTP control connection closed during GET %s."
287
285
                warning("FTP control connection closed. Trying to reopen.")
288
286
                time.sleep(_sleep_between_retries)
289
287
                self._reconnect()
290
 
                return self.get(relpath, decode, retries+1)
 
288
                return self.get(relpath, retries+1)
291
289
 
292
290
    def put_file(self, relpath, fp, mode=None, retries=0):
293
291
        """Copy the file-like or string object into the location.