| 708 | return self.meta_from_decoded(self.decode(payload)) |
| 709 | |
| 710 | def decode(self, payload): |
| 711 | if payload is None: |
| 712 | return payload |
| 713 | payload = payload or str(payload) |
| 714 | # Driven by the payload itself rather than by ``self.compression`` so |
| 715 | # that a result stays readable after the setting is turned off again, |
| 716 | # and so that a reader that never had it turned on can still read a |
| 717 | # result written by a worker that did. |
| 718 | payload = decompress_payload(payload) |
| 719 | return loads(payload, |
| 720 | content_type=self.content_type, |
| 721 | content_encoding=self.content_encoding, |
| 722 | accept=self.accept) |
| 723 | |
| 724 | def prepare_compression(self, compression): |
| 725 | """Return the compression method to encode results with. |