/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/__init__.py

Fix python-2.4 compatibility.

* bzrlib/transport/ftp/__init__.py:
(FtpTransport.list_dir): try/except/finally features are reduced
under python-2.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
519
519
        mutter("FTP nlst: %s", basepath)
520
520
        f = self._get_FTP()
521
521
        try:
522
 
            paths = f.nlst(basepath)
523
 
        except ftplib.error_perm, e:
524
 
            self._translate_perm_error(e, relpath, extra='error with list_dir')
525
 
        except ftplib.error_temp, e:
526
 
            # xs4all's ftp server raises a 450 temp error when listing an empty
527
 
            # directory. Check for that and just return an empty list in that
528
 
            # case. See bug #215522
529
 
            if str(e).lower().startswith('450 no files found'):
530
 
                mutter('FTP Server returned "%s" for nlst.'
531
 
                       ' Assuming it means empty directory',
532
 
                       str(e))
533
 
                return []
534
 
            raise
 
522
            try:
 
523
                paths = f.nlst(basepath)
 
524
            except ftplib.error_perm, e:
 
525
                self._translate_perm_error(e, relpath,
 
526
                                           extra='error with list_dir')
 
527
            except ftplib.error_temp, e:
 
528
                # xs4all's ftp server raises a 450 temp error when listing an
 
529
                # empty directory. Check for that and just return an empty list
 
530
                # in that case. See bug #215522
 
531
                if str(e).lower().startswith('450 no files found'):
 
532
                    mutter('FTP Server returned "%s" for nlst.'
 
533
                           ' Assuming it means empty directory',
 
534
                           str(e))
 
535
                    return []
 
536
                raise
535
537
        finally:
536
538
            # Restore binary mode as nlst switch to ascii mode to retrieve file
537
539
            # list