Package twisted :: Package protocols :: Module ftp :: Class FTPFileListProtocol
[show private | hide private]
[frames | no frames]

Class FTPFileListProtocol

BaseProtocol --+        
               |        
        Protocol --+    
                   |    
        LineReceiver --+
                       |
                      FTPFileListProtocol


Parser for standard FTP file listings

This is the evil required to match:
   -rw-r--r--   1 root     other        531 Jan 29 03:26 README

If you need different evil for a wacky FTP server, you can override this.

It populates the instance attribute self.files, which is a list containing dicts with the following keys (examples from the above line): Note that the 'date' value will be formatted differently depending on the date. Check http://cr.yp.to/ftp.html if you really want to try to parse it.
Method Summary
  __init__(self)
  connectionFailed(self)
(Deprecated) (inherited from Protocol)
  connectionLost(self, reason)
Called when the connection is shut down. (inherited from Protocol)
  dataReceived(self, data)
Protocol.dataReceived. (inherited from LineReceiver)
  lineLengthExceeded(self, line)
Called when the maximum line length has been reached. (inherited from LineReceiver)
  lineReceived(self, line)
Override this for when each line is received.
  rawDataReceived(self, data)
Override this for when raw data is received. (inherited from LineReceiver)
  sendLine(self, line)
Sends a line to the other end of the connection. (inherited from LineReceiver)
  setLineMode(self, extra)
Sets the line-mode of this receiver. (inherited from LineReceiver)
  setRawMode(self)
Sets the raw mode of this receiver. (inherited from LineReceiver)

Instance Variable Summary
  files - list of dicts describing the files in this listing

Class Variable Summary
str delimiter
SRE_Pattern fileLinePattern

Method Details

lineReceived(self, line)

Override this for when each line is received.
Overrides:
twisted.protocols.basic.LineReceiver.lineReceived (inherited documentation)

Instance Variable Details

files

list of dicts describing the files in this listing

Class Variable Details

delimiter

Type:
str
Value:
'''
'''                                                                    

fileLinePattern

Type:
SRE_Pattern
Value:
^(.)(.{9})\s+\d*\s*(\S+)\s+(\S+)\s+(\d+)\s+(... .. ..:..)\s+(.*?)\r?$  

Generated by Epydoc 1.2 prerelease on Wed Jan 29 06:25:48 2003 http://epydoc.sf.net