Changeset 1600:5a4abb73e8a1

Timestamp:
Nov 1, 2015, 9:55:42 PM (6 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Add session adapter for ticket #100

Under Python 2, `ftplib.FTP` (and compatible classes) don't work with
unicode string arguments if they contain non-ASCII characters. ftputil
always converts strings to unicode to be compatible with Python 3's
`ftplib`. Hence, no `FTPHost` method works if it's fed byte strings or
unicode strings that contain non-ASCII characters. (There are no such
problems with `ftplib.FTP` under Python 3, as long as unicode string
arguments contain only code points <= 255. The reason is explained in
the `session_adapter` module's docstring.)

On Python 2, the function `adapted_session_factory` returns an adapter
class for `ftplib.FTP`-compatible session factories. On Python 3, no
modification of the session factory is necessary, so
`adapted_session_factory` returns the session factory unchanged.
File:
1 added

Note: See TracChangeset for help on using the changeset viewer.