Ignore:
Timestamp:
Jun 7, 2014, 10:06:24 AM (5 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Added support for `followlinks` in `FTPHost.walk` (ticket #73).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ftputil/host.py

    r1502 r1506  
    846846        return self._stat._stat(path, _exception_for_missing_path)
    847847
    848     def walk(self, top, topdown=True, onerror=None):
     848    def walk(self, top, topdown=True, onerror=None, followlinks=False):
    849849        """
    850850        Iterate over directory tree and return a tuple (dirpath,
    851851        dirnames, filenames) on each iteration, like the `os.walk`
    852         function (see http://docs.python.org/lib/os-file-dir.html ).
     852        function (see https://docs.python.org/library/os.html#os.walk ).
    853853        """
    854854        top = ftputil.tool.as_unicode(top)
     
    871871        for name in dirs:
    872872            path = self.path.join(top, name)
    873             if not self.path.islink(path):
    874                 for item in self.walk(path, topdown, onerror):
     873            if followlinks or not self.path.islink(path):
     874                for item in self.walk(path, topdown, onerror, followlinks):
    875875                    yield item
    876876        if not topdown:
Note: See TracChangeset for help on using the changeset viewer.