The representation of the data that should be uploaded to the server. This might be compressed based on the content type and size.
(self)
| 50 | return f.read() |
| 51 | |
| 52 | def payload(self): |
| 53 | """ |
| 54 | The representation of the data that should be uploaded to the |
| 55 | server. This might be compressed based on the content type and size. |
| 56 | """ |
| 57 | if not hasattr(self, '_payload'): |
| 58 | raw_data = self.data() |
| 59 | |
| 60 | if self.extension() in self.engine.site.compress_extensions: |
| 61 | compressed_data = compressString(raw_data) |
| 62 | |
| 63 | if len(compressed_data) < len(raw_data): |
| 64 | self._is_compressed = True |
| 65 | self._payload = compressed_data |
| 66 | return self._payload |
| 67 | |
| 68 | self.is_compressed = False |
| 69 | self._payload = raw_data |
| 70 | |
| 71 | return self._payload |
| 72 | |
| 73 | @property |
| 74 | def is_compressed(self): |