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