Beispiel #1
0
 def download(self, source, target, mode='', callback=None):
     """
     Download a file from the remote source (name) to the local
     target (name). The argument mode is an empty string or 'a' for
     text copies, or 'b' for binary copies.
     """
     source_file, target_file = self._download_files(source, target, mode)
     file_transfer.copy_file(source_file, target_file,
                             conditional=False, callback=callback)
Beispiel #2
0
 def download(self, source, target, mode='', callback=None):
     """
     Download a file from the remote source (name) to the local
     target (name). The argument mode is an empty string or 'a' for
     text copies, or 'b' for binary copies.
     """
     # Fail early if we get a unicode path which can't be encoded.
     # Only attempt to convert the remote `source` name to a
     # bytestring. We leave it to the local filesystem whether it
     # wants to support unicode filenames or not.
     source = str(source)
     source_file, target_file = self._download_files(source, target, mode)
     file_transfer.copy_file(source_file, target_file,
                             conditional=False, callback=callback)
Beispiel #3
0
 def download(self, source, target, mode='', callback=None):
     """
     Download a file from the remote source (name) to the local
     target (name). The argument mode is an empty string or 'a' for
     text copies, or 'b' for binary copies.
     """
     # Fail early if we get a unicode path which can't be encoded.
     # Only attempt to convert the remote `source` name to a
     # bytestring. We leave it to the local filesystem whether it
     # wants to support unicode filenames or not.
     source = str(source)
     source_file, target_file = self._download_files(source, target, mode)
     file_transfer.copy_file(source_file,
                             target_file,
                             conditional=False,
                             callback=callback)
Beispiel #4
0
    def download_if_newer(self, source, target, mode='', callback=None):
        """
        Download a file only if it's newer than the target on the
        local host or if the target file does not exist. See the
        method `download` for the meaning of the parameters.

        If a download was necessary, return `True`, else return
        `False`.
        """
        source_file, target_file = self._download_files(source, target, mode)
        return file_transfer.copy_file(source_file, target_file,
                                       conditional=True, callback=callback)
Beispiel #5
0
    def upload_if_newer(self, source, target, mode='', callback=None):
        """
        Upload a file only if it's newer than the target on the
        remote host or if the target file does not exist. See the
        method `upload` for the meaning of the parameters.

        If an upload was necessary, return `True`, else return
        `False`.
        """
        # See comment in `upload`.
        target = str(target)
        source_file, target_file = self._upload_files(source, target, mode)
        return file_transfer.copy_file(source_file, target_file,
                                       conditional=True, callback=callback)
Beispiel #6
0
    def upload_if_newer(self, source, target, mode='', callback=None):
        """
        Upload a file only if it's newer than the target on the
        remote host or if the target file does not exist. See the
        method `upload` for the meaning of the parameters.

        If an upload was necessary, return `True`, else return
        `False`.
        """
        # See comment in `upload`.
        target = str(target)
        source_file, target_file = self._upload_files(source, target, mode)
        return file_transfer.copy_file(source_file,
                                       target_file,
                                       conditional=True,
                                       callback=callback)