Ticket #35 (closed defect: fixed)
fixture.py: form-parsing not always case-insensitive
| Reported by: | Jonas Borgström <jonas@…> | Owned by: | ianb |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.4.1 |
| Component: | paste | Version: | svn-trunk |
| Severity: | normal | Keywords: | eUkhMonIyKEYSkUmUdS |
| Cc: | jonas@… |
Description
The patch below makes the Form._tag_re regular expression case insensitive and also stops the parser from trying to parse action/method/id attributes from the </form>-tag.
Index: paste/fixture.py
===================================================================
--- paste/fixture.py (revision 3707)
+++ paste/fixture.py (working copy)
@@ -748,7 +748,7 @@
# @@: This really should be using Mechanize/ClientForm or
# something...
- _tag_re = re.compile(r'<(/?)([a-z0-9_-]*)([^>]*?)>')
+ _tag_re = re.compile(r'<(/?)([a-z0-9_-]*)([^>]*?)>', re.I)
def __init__(self, response, text):
self.response = response
@@ -824,13 +824,13 @@
tag = match.group(2).lower()
if tag != 'form':
continue
+ # @@: enctype?
+ if end:
+ break
attrs = _parse_attrs(match.group(3))
self.action = attrs.get('action', '')
self.method = attrs.get('method', 'GET')
self.id = attrs.get('id')
- # @@: enctype?
- if end:
- break
else:
assert 0, "No </form> tag found"
assert self.action is not None, (
Change History
Note: See
TracTickets for help on using
tickets.
