diff options
| author | ianb <devnull@localhost> | 2005-12-29 23:41:28 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-12-29 23:41:28 +0000 |
| commit | ece2c3f4f983898c445dcd403bc50784192f331b (patch) | |
| tree | da5f1a98b6cd8e7452fecbff2bd78fe37e720855 /paste | |
| parent | d3e385a7ef977091e4c81162881f66f1b3d30d20 (diff) | |
| download | paste-ece2c3f4f983898c445dcd403bc50784192f331b.tar.gz | |
Applied patch for boolean HTML attributes in test fixture form parsing, from jonas@edgewall.com
Diffstat (limited to 'paste')
| -rw-r--r-- | paste/fixture.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/paste/fixture.py b/paste/fixture.py index 949503d..b242aa5 100644 --- a/paste/fixture.py +++ b/paste/fixture.py @@ -788,7 +788,7 @@ class Form(object): name = None if tag == 'option': in_select.options.append((attrs.get('value'), - attrs.get('selected'))) + 'selected' in attrs)) continue if tag == 'input' and attrs.get('type') == 'radio': field = self.fields.get(name) @@ -799,7 +799,7 @@ class Form(object): field = field[0] assert isinstance(field, Radio) field.options.append((attrs.get('value'), - attrs.get('checked'))) + 'checked' in attrs)) continue tag_type = tag if tag == 'input': @@ -941,7 +941,7 @@ class Form(object): return submit -_attr_re = re.compile(r'([^= \n\r\t]*)[ \n\r\t]*=[ \n\r\t]*(?:"([^"]*)"|([^"][^ \n\r\t>]*))', re.S) +_attr_re = re.compile(r'([^= \n\r\t]+)[ \n\r\t]*(?:=[ \n\r\t]*(?:"([^"]*)"|([^"][^ \n\r\t>]*)))?', re.S) def _parse_attrs(text): attrs = {} @@ -1040,7 +1040,7 @@ class Checkbox(Field): def __init__(self, *args, **attrs): super(Checkbox, self).__init__(*args, **attrs) - self.checked = attrs.get('checked') is not None + self.checked = 'checked' in attrs def value__set(self, value): self.checked = not not value |
