def _write_details(self, details): """Output details to the stream. :param details: An extended details dict for a test outcome. """ self._stream.write(_b(" [ multipart\n")) for name, content in sorted(details.items()): self._stream.write(_b("Content-Type: %s/%s" % (content.content_type.type, content.content_type.subtype))) parameters = content.content_type.parameters if parameters: self._stream.write(_b(";")) param_strs = [] for param, value in parameters.items(): param_strs.append("%s=%s" % (param, value)) self._stream.write(_b(",".join(param_strs))) self._stream.write(_b("\n%s\n" % name)) encoder = chunked.Encoder(self._stream) list(map(encoder.write, content.iter_bytes())) encoder.close()
def _write_details(self, details): """Output details to the stream. :param details: An extended details dict for a test outcome. """ self._stream.write(" [ multipart\n") for name, content in sorted(details.iteritems()): self._stream.write("Content-Type: %s/%s" % (content.content_type.type, content.content_type.subtype)) parameters = content.content_type.parameters if parameters: self._stream.write(";") param_strs = [] for param, value in parameters.iteritems(): param_strs.append("%s=%s" % (param, value)) self._stream.write(",".join(param_strs)) self._stream.write("\n%s\n" % name) encoder = chunked.Encoder(self._stream) map(encoder.write, content.iter_bytes()) encoder.close()