[CFWS] 1*extended_attrtext [CFWS] This is like the non-extended version except we allow % characters, so that we can pick up an encoded value as a single string.
(value)
| 2411 | return attrtext, value |
| 2412 | |
| 2413 | def get_extended_attribute(value): |
| 2414 | """ [CFWS] 1*extended_attrtext [CFWS] |
| 2415 | |
| 2416 | This is like the non-extended version except we allow % characters, so that |
| 2417 | we can pick up an encoded value as a single string. |
| 2418 | |
| 2419 | """ |
| 2420 | # XXX: should we have an ExtendedAttribute TokenList? |
| 2421 | attribute = Attribute() |
| 2422 | if value and value[0] in CFWS_LEADER: |
| 2423 | token, value = get_cfws(value) |
| 2424 | attribute.append(token) |
| 2425 | if value and value[0] in EXTENDED_ATTRIBUTE_ENDS: |
| 2426 | raise errors.HeaderParseError( |
| 2427 | "expected token but found '{}'".format(value)) |
| 2428 | token, value = get_extended_attrtext(value) |
| 2429 | attribute.append(token) |
| 2430 | if value and value[0] in CFWS_LEADER: |
| 2431 | token, value = get_cfws(value) |
| 2432 | attribute.append(token) |
| 2433 | return attribute, value |
| 2434 | |
| 2435 | def get_section(value): |
| 2436 | """ '*' digits |