ttext = We allow any non-TOKEN_ENDS in ttext, but add defects to the token's defects list if we find non-ttext characters. We also register defects for *any* non-printables even though the RFC doesn't exclude all of them, because we follow the spirit of RFC
(value)
| 2266 | return invalid_parameter, value |
| 2267 | |
| 2268 | def get_ttext(value): |
| 2269 | """ttext = <matches _ttext_matcher> |
| 2270 | |
| 2271 | We allow any non-TOKEN_ENDS in ttext, but add defects to the token's |
| 2272 | defects list if we find non-ttext characters. We also register defects for |
| 2273 | *any* non-printables even though the RFC doesn't exclude all of them, |
| 2274 | because we follow the spirit of RFC 5322. |
| 2275 | |
| 2276 | """ |
| 2277 | m = _non_token_end_matcher(value) |
| 2278 | if not m: |
| 2279 | raise errors.HeaderParseError( |
| 2280 | "expected ttext but found '{}'".format(value)) |
| 2281 | ttext = m.group() |
| 2282 | value = value[len(ttext):] |
| 2283 | ttext = ValueTerminal(ttext, 'ttext') |
| 2284 | _validate_xtext(ttext) |
| 2285 | return ttext, value |
| 2286 | |
| 2287 | def get_token(value): |
| 2288 | """token = [CFWS] 1*ttext [CFWS] |
no test coverage detected