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)
| 2309 | return invalid_parameter, value |
| 2310 | |
| 2311 | def get_ttext(value): |
| 2312 | """ttext = <matches _ttext_matcher> |
| 2313 | |
| 2314 | We allow any non-TOKEN_ENDS in ttext, but add defects to the token's |
| 2315 | defects list if we find non-ttext characters. We also register defects for |
| 2316 | *any* non-printables even though the RFC doesn't exclude all of them, |
| 2317 | because we follow the spirit of RFC 5322. |
| 2318 | |
| 2319 | """ |
| 2320 | m = _non_token_end_matcher(value) |
| 2321 | if not m: |
| 2322 | raise errors.HeaderParseError( |
| 2323 | "expected ttext but found '{}'".format(value)) |
| 2324 | ttext = m.group() |
| 2325 | value = value[len(ttext):] |
| 2326 | ttext = ValueTerminal(ttext, 'ttext') |
| 2327 | _validate_xtext(ttext) |
| 2328 | return ttext, value |
| 2329 | |
| 2330 | def get_token(value): |
| 2331 | """token = [CFWS] 1*ttext [CFWS] |
no test coverage detected
searching dependent graphs…