+ Header folding is controlled by the refold_source policy setting. A value is considered to be a 'source value' if and only if it does not have a 'name' attribute (having a 'name' attribute means it is a header object of some sort). If a source value needs to be re
(self, name, value)
| 170 | return self.header_factory(name, value) |
| 171 | |
| 172 | def fold(self, name, value): |
| 173 | """+ |
| 174 | Header folding is controlled by the refold_source policy setting. A |
| 175 | value is considered to be a 'source value' if and only if it does not |
| 176 | have a 'name' attribute (having a 'name' attribute means it is a header |
| 177 | object of some sort). If a source value needs to be refolded according |
| 178 | to the policy, it is converted into a custom header object by passing |
| 179 | the name and the value with any linesep characters removed to the |
| 180 | header_factory method. Folding of a custom header object is done by |
| 181 | calling its fold method with the current policy. |
| 182 | |
| 183 | Source values are split into lines using splitlines. If the value is |
| 184 | not to be refolded, the lines are rejoined using the linesep from the |
| 185 | policy and returned. The exception is lines containing non-ascii |
| 186 | binary data. In that case the value is refolded regardless of the |
| 187 | refold_source setting, which causes the binary data to be CTE encoded |
| 188 | using the unknown-8bit charset. |
| 189 | |
| 190 | """ |
| 191 | return self._fold(name, value, refold_binary=True) |
| 192 | |
| 193 | def fold_binary(self, name, value): |
| 194 | """+ |
no test coverage detected