| 678 | |
| 679 | |
| 680 | class Parameter(TokenList): |
| 681 | |
| 682 | token_type = 'parameter' |
| 683 | sectioned = False |
| 684 | extended = False |
| 685 | charset = 'us-ascii' |
| 686 | |
| 687 | @property |
| 688 | def section_number(self): |
| 689 | # Because the first token, the attribute (name) eats CFWS, the second |
| 690 | # token is always the section if there is one. |
| 691 | return self[1].number if self.sectioned else 0 |
| 692 | |
| 693 | @property |
| 694 | def param_value(self): |
| 695 | # This is part of the "handle quoted extended parameters" hack. |
| 696 | for token in self: |
| 697 | if token.token_type == 'value': |
| 698 | return token.stripped_value |
| 699 | if token.token_type == 'quoted-string': |
| 700 | for token in token: |
| 701 | if token.token_type == 'bare-quoted-string': |
| 702 | for token in token: |
| 703 | if token.token_type == 'value': |
| 704 | return token.stripped_value |
| 705 | return '' |
| 706 | |
| 707 | |
| 708 | class InvalidParameter(Parameter): |
no outgoing calls
no test coverage detected
searching dependent graphs…