Ticket #35 (closed defect: fixed)

Opened 6 years ago

Last modified 3 years ago

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

Changed 6 years ago by ianb

  • status changed from new to closed
  • resolution set to fixed

Applied in r3711

Changed 6 years ago by jonas@…

  • status changed from closed to reopened
  • resolution fixed deleted

Why did you decide not to apply the second half of the patch? As far as I can tell the id/method/action-parsing doesn't work without it.

Changed 6 years ago by ianb

  • status changed from reopened to closed
  • resolution set to fixed

I guess I just spaced out when applying it. Fully applied in r3719.

Changed 6 years ago by anonymous

Great resource. Really helpful for understand odbc things.

Thanks.

my email:googlefans@163.com

=============Some my site====================

1. wow gold

2. world of warcraft gold

3. wow gold

Note: See TracTickets for help on using tickets.