From bd42c2b00d0e4a18d15fd494bd9b9101742c4a37 Mon Sep 17 00:00:00 2001 From: Joel Wright Date: Sun, 4 Jan 2015 21:14:02 +0000 Subject: 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 --- swiftclient/multithreading.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'swiftclient/multithreading.py') 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 -- cgit v1.2.1