attrtext = 1*(any non-ATTRIBUTE_ENDS character) We allow any non-ATTRIBUTE_ENDS in attrtext, but add defects to the token's defects list if we find non-attrtext characters. We also register defects for *any* non-printables even though the RFC doesn't exclude all of them, because we
(value)
| 2308 | return mtoken, value |
| 2309 | |
| 2310 | def get_attrtext(value): |
| 2311 | """attrtext = 1*(any non-ATTRIBUTE_ENDS character) |
| 2312 | |
| 2313 | We allow any non-ATTRIBUTE_ENDS in attrtext, but add defects to the |
| 2314 | token's defects list if we find non-attrtext characters. We also register |
| 2315 | defects for *any* non-printables even though the RFC doesn't exclude all of |
| 2316 | them, because we follow the spirit of RFC 5322. |
| 2317 | |
| 2318 | """ |
| 2319 | m = _non_attribute_end_matcher(value) |
| 2320 | if not m: |
| 2321 | raise errors.HeaderParseError( |
| 2322 | "expected attrtext but found {!r}".format(value)) |
| 2323 | attrtext = m.group() |
| 2324 | value = value[len(attrtext):] |
| 2325 | attrtext = ValueTerminal(attrtext, 'attrtext') |
| 2326 | _validate_xtext(attrtext) |
| 2327 | return attrtext, value |
| 2328 | |
| 2329 | def get_attribute(value): |
| 2330 | """ [CFWS] 1*attrtext [CFWS] |
no test coverage detected