Ignore:
Timestamp:
Jul 28, 2013, 12:09:32 PM (6 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Ensure `FTPHost.path.exists` accepts both bytes and unicode strings.

Note that this new requirement is conflicting with the approach
introduced with ticket #53
( http://ftputil.sschwarzer.net/trac/ticket/53 ). That ticket was
about FTP commands failing because of "non-encodable" unicode strings.

The new approach is to allow both bytes and unicode strings as
arguments because this is the behavior of Python 2 and 3 for the
corresponding `os` functions.

Accordingly, all test cases in `test_real_ftp.TestUnicodePaths` will
become obsolete and will eventually be removed. (On the other hand,
new tests are added to make sure that methods take bytes and unicode
strings.)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ftputil/host.py

    r1245 r1273  
    828828        _not_ intended for use by ftputil clients.)
    829829        """
    830         # Fail early if we get a unicode path which can't be encoded.
    831         path = str(path)
    832830        return self._stat._lstat(path, _exception_for_missing_path)
    833831
     
    845843        _not_ intended for use by ftputil clients.)
    846844        """
    847         # Fail early if we get a unicode path which can't be encoded.
    848         path = str(path)
    849845        return self._stat._stat(path, _exception_for_missing_path)
    850846
Note: See TracChangeset for help on using the changeset viewer.