Logo Search packages:      
Sourcecode: s3ql version File versions  Download package

def s3ql::backends::ftplib::FTP::storlines (   self,
  cmd,
  fp,
  callback = None 
)
Store a file in line mode.  A new port is created for you.

Args:
  cmd: A STOR command.
  fp: A file-like object with a readline() method.
  callback: An optional single parameter callable that is called on
    on each line after it is sent.  [default: None]

Returns:
  The response code.

Reimplemented in s3ql::backends::ftplib::FTP_TLS.

Definition at line 465 of file ftplib.py.

                                               :
        """Store a file in line mode.  A new port is created for you.

        Args:
          cmd: A STOR command.
          fp: A file-like object with a readline() method.
          callback: An optional single parameter callable that is called on
                    on each line after it is sent.  [default: None]

        Returns:
          The response code.
        """
        self.voidcmd('TYPE A')
        conn = self.transfercmd(cmd)
        while 1:
            buf = fp.readline()
            if not buf: break
            if buf[-2:] != CRLF:
                if buf[-1] in CRLF: buf = buf[:-1]
                buf = buf + CRLF
            conn.sendall(buf)
            if callback: callback(buf)
        conn.close()
        return self.voidresp()


Generated by  Doxygen 1.6.0   Back to index