571
571
self.mkdir(parent_dir)
572
572
return self.put_file(relpath, f, mode=mode)
574
def non_atomic_put_bytes(self, relpath, bytes, mode=None,
575
create_parent_dir=False):
576
"""Copy the string into the target location.
578
This function is not strictly safe to use. See
579
Transport.non_atomic_put_bytes for more information.
581
:param relpath: The remote location to put the contents.
582
:param bytes: A string object containing the raw bytes to write into
584
:param mode: Possible access permissions for new file.
585
None means do not set remote permissions.
586
:param create_parent_dir: If we cannot create the target file because
587
the parent directory does not exist, go ahead and
588
create it, and then try again.
590
assert isinstance(bytes, str), \
591
'bytes must be a plain string, not %s' % type(bytes)
592
self.non_atomic_put_file(relpath, StringIO(bytes), mode=mode,
593
create_parent_dir=create_parent_dir)
574
595
@deprecated_method(zero_eleven)
575
596
def put_multi(self, files, mode=None, pb=None):
576
597
"""Put a set of files into the location.