diff options
author | Joel Wright <joel.wright@sohonet.com> | 2015-01-04 21:14:02 +0000 |
---|---|---|
committer | Joel Wright <joel.wright@sohonet.com> | 2015-01-23 11:46:13 +0000 |
commit | bd42c2b00d0e4a18d15fd494bd9b9101742c4a37 (patch) | |
tree | 13aeb9c42ef70b6cd13a9bd3fd001cb66c81e1c5 /swiftclient/multithreading.py | |
parent | 7709fea51e71084163cf56c4d11a280ca4388357 (diff) | |
download | python-swiftclient-bd42c2b00d0e4a18d15fd494bd9b9101742c4a37.tar.gz |
This patch fixes downloading files to stdout.
This patch fixes downloading files to stdout and modifies
_SwiftReader to operate as an iterator that performs file
checks at the end of iteration as well as a context manager.
File verification checks have been removed from __exit__
and added to __iter__.
Change-Id: I3250bdeeef8484a9122c4b5b854756a7c8f8731e
Closes-Bug: 1395922
Closes-Bug: 1387376
Diffstat (limited to 'swiftclient/multithreading.py')
-rw-r--r-- | swiftclient/multithreading.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/swiftclient/multithreading.py b/swiftclient/multithreading.py index ade0f7b..d8eb5f6 100644 --- a/swiftclient/multithreading.py +++ b/swiftclient/multithreading.py @@ -67,6 +67,17 @@ class OutputManager(object): self.error_print_pool.__exit__(exc_type, exc_value, traceback) self.print_pool.__exit__(exc_type, exc_value, traceback) + def print_raw(self, data): + self.print_pool.submit(self._write, data, self.print_stream) + + def _write(self, data, stream): + if six.PY3: + stream.buffer.write(data) + stream.flush() + if six.PY2: + stream.write(data) + stream.flush() + def print_msg(self, msg, *fmt_args): if fmt_args: msg = msg % fmt_args |