Changeset 260
- Timestamp:
- 2003-06-09 18:29:32 (6 years ago)
- Files:
-
- trunk/ftp_stat.py (modified) (3 diffs)
- trunk/ftputil.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ftp_stat.py
r258 r260 34 34 """ 35 35 36 # $Id: ftp_stat.py,v 1.1 0 2003/06/09 18:16:45schwa Exp $36 # $Id: ftp_stat.py,v 1.11 2003/06/09 18:29:32 schwa Exp $ 37 37 38 38 import stat … … 89 89 stat_results = [ self.parse_line(line) for line in lines ] 90 90 return stat_results 91 92 def _host_dir(self, path): 93 """Return a list of lines, as fetched by FTP's `DIR` command.""" 94 return self._host._dir(path) 95 96 def listdir(self, path): 97 """ 98 Return a list with directories, files etc. in the directory 99 named path. 100 """ 101 host_path = self._host.path 102 # we _can't_ put this check into `_dir`, s. a. 103 path = host_path.abspath(path) 104 if not host_path.isdir(path): 105 raise ftp_error.PermanentError("550 %s: no such directory" % path) 106 lines = self._host_dir(path) 107 names = [] 108 for line in lines: 109 try: 110 stat_result = self.parse_line(line) 111 except ftp_error.ParserError: 112 pass 113 else: 114 names.append(stat_result._st_name) 115 return names 91 116 92 117 def _stat_candidates(self, lines, wanted_name): … … 112 137 "can't invoke stat for remote root directory") 113 138 dirname, basename = host_path.split(path) 114 lines = self._host ._dir(dirname)139 lines = self._host_dir(dirname) 115 140 # search for name to be stat'ed without parsing the whole 116 141 # directory listing trunk/ftputil.py
r258 r260 30 30 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 31 32 # $Id: ftputil.py,v 1.12 5 2003/06/09 18:16:45schwa Exp $32 # $Id: ftputil.py,v 1.126 2003/06/09 18:29:32 schwa Exp $ 33 33 34 34 """ … … 521 521 522 522 def listdir(self, path): 523 """ 524 Return a list with directories, files etc. in the directory 525 named path. 526 """ 527 # we _can't_ put this check into `_dir`, s. a. 528 path = self.path.abspath(path) 529 if not self.path.isdir(path): 530 raise ftp_error.PermanentError("550 %s: no such directory" % path) 531 lines = self._dir(path) 532 names = [] 533 for line in lines: 534 try: 535 stat_result = self._stat.parse_line(line) 536 except ftp_error.ParserError: 537 pass 538 else: 539 names.append(stat_result._st_name) 540 return names 523 return self._stat.listdir(path) 541 524 542 525 def lstat(self, path):
