Ignore:
Timestamp:
Nov 22, 2015, 6:04:14 PM (4 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Remove function `adapted_session`; apply `SessionAdapter` directly

Don't keep the helper function `adapted_session` for applying it just
once. Instead, when adapting an FTP session for Python 2 in
`ftputil.host._make_session`, wrap it in a `SessionAdapter` object
directly.

This is like the wrapping in `ftputil.file.FTPFile._open` where we
have the Python version check directly in the method.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ftputil/host.py

    r1603 r1610  
    113113    #
    114114    # Dealing with child sessions and file-like objects
    115     #  (rather low-level)
     115    # (rather low-level)
    116116    #
    117117    def _make_session(self):
     
    133133        # code points <= 255). See the docstring in module
    134134        # `session_adapter` for details.
    135         return ftputil.session_adapter.adapted_session(session)
     135        if ftputil.compat.python_version == 2:
     136            session = ftputil.session_adapter.SessionAdapter(session)
     137        return session
    136138
    137139    def _copy(self):
Note: See TracChangeset for help on using the changeset viewer.