~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge sftp-leaks into catch-them-all

Show diffs side-by-side

added added

removed removed

Lines of Context:
196
196
            or 'file/directory not found' in s # filezilla server
197
197
            # Microsoft FTP-Service RNFR reply if file not found
198
198
            or (s.startswith('550 ') and 'unable to rename to' in extra)
 
199
            # if containing directory doesn't exist, suggested by
 
200
            # <https://bugs.edge.launchpad.net/bzr/+bug/224373>
 
201
            or (s.startswith('550 ') and "can't find folder" in s)
199
202
            ):
200
203
            raise errors.NoSuchFile(path, extra=extra)
201
204
        elif ('file exists' in s):
319
322
                    return len(bytes)
320
323
                else:
321
324
                    return fp.counted_bytes
322
 
            except (ftplib.error_temp,EOFError), e:
323
 
                warning("Failure during ftp PUT. Deleting temporary file.")
 
325
            except (ftplib.error_temp, EOFError), e:
 
326
                warning("Failure during ftp PUT of %s: %s. Deleting temporary file."
 
327
                    % (tmp_abspath, e, ))
324
328
                try:
325
329
                    f.delete(tmp_abspath)
326
330
                except:
333
337
                                       unknown_exc=errors.NoSuchFile)
334
338
        except ftplib.error_temp, e:
335
339
            if retries > _number_of_retries:
336
 
                raise errors.TransportError("FTP temporary error during PUT %s. Aborting."
337
 
                                     % self.abspath(relpath), orig_error=e)
 
340
                raise errors.TransportError(
 
341
                    "FTP temporary error during PUT %s: %s. Aborting."
 
342
                    % (self.abspath(relpath), e), orig_error=e)
338
343
            else:
339
344
                warning("FTP temporary error: %s. Retrying.", str(e))
340
345
                self._reconnect()
355
360
        try:
356
361
            mutter("FTP mkd: %s", abspath)
357
362
            f = self._get_FTP()
358
 
            f.mkd(abspath)
 
363
            try:
 
364
                f.mkd(abspath)
 
365
            except ftplib.error_reply, e:
 
366
                # <https://bugs.launchpad.net/bzr/+bug/224373> Microsoft FTP
 
367
                # server returns "250 Directory created." which is kind of
 
368
                # reasonable, 250 meaning "requested file action OK", but not what
 
369
                # Python's ftplib expects.
 
370
                if e[0][:3] == '250':
 
371
                    pass
 
372
                else:
 
373
                    raise
359
374
            self._setmode(relpath, mode)
360
375
        except ftplib.error_perm, e:
361
376
            self._translate_ftp_error(e, abspath,