+ If the value has a 'name' attribute, it is returned to unmodified. Otherwise the name and the value with any linesep characters removed are passed to the header_factory method, and the resulting custom header object is returned. Any surrogateescaped bytes get turne
(self, name, value)
| 155 | return (name, self.header_factory(name, value)) |
| 156 | |
| 157 | def header_fetch_parse(self, name, value): |
| 158 | """+ |
| 159 | If the value has a 'name' attribute, it is returned to unmodified. |
| 160 | Otherwise the name and the value with any linesep characters removed |
| 161 | are passed to the header_factory method, and the resulting custom |
| 162 | header object is returned. Any surrogateescaped bytes get turned |
| 163 | into the unicode unknown-character glyph. |
| 164 | |
| 165 | """ |
| 166 | if hasattr(value, 'name'): |
| 167 | return value |
| 168 | # We can't use splitlines here because it splits on more than \r and \n. |
| 169 | value = ''.join(linesep_splitter.split(value)) |
| 170 | return self.header_factory(name, value) |
| 171 | |
| 172 | def fold(self, name, value): |
| 173 | """+ |