Ignore:
Timestamp:
May 31, 2012, 1:45:58 PM (8 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
If the server's `LIST` command accepts the `-a` option, use it.
The option will be used for all subsequent directory requests.

With some servers, this makes the server send directory lines
where the file or directory entry starts with a dot. However,
there's no _guarantee_ that such entries will be displayed even
if the `-a` option is used.

Note that the fact that the FTP server doesn't complain about the
`-a` option means the option has an effect. I did an experiment
and tried arbitrary "options" with `LIST`, but neither gave an
error message, but just a directory listing as without the `-a`
option.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/mock_ftplib.py

    r1083 r1096  
    172172        self.current_dir = self._transform_path(path)
    173173
    174     def dir(self, path, callback=None):
     174    def dir(self, *args):
    175175        """Provide a callback function for processing each line of
    176176        a directory listing. Return nothing.
    177177        """
     178        if callable(args[-1]):
     179            callback = args[-1]
     180            args = args[:-1]
     181        else:
     182            callback = None
     183        # Everything before the path argument are options.
     184        path = args[-1]
    178185        if DEBUG:
    179186            print 'dir: %s' % path
Note: See TracChangeset for help on using the changeset viewer.