From cd7e4f5afc2bb094712053816ab1c74a6054af96 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 1 Apr 2011 22:12:24 +0000 Subject: [PATCH] improvement for lots of multiple-selection forms (now by default the first one is selected - till now it was left unchecked which lead to blank get/post data for the whole form) --- extra/clientform/clientform.py | 4 ++-- lib/core/option.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/extra/clientform/clientform.py b/extra/clientform/clientform.py index 7c59d4750..d9e2eec73 100644 --- a/extra/clientform/clientform.py +++ b/extra/clientform/clientform.py @@ -2754,7 +2754,7 @@ class HTMLForm: # Initialisation. Use ParseResponse / ParseFile instead. def __init__(self, action, method="GET", - enctype="application/x-www-form-urlencoded", + enctype=None, name=None, attrs=None, request_class=urllib2.Request, forms=None, labels=None, id_to_labels=None, @@ -2772,7 +2772,7 @@ class HTMLForm: """ self.action = action self.method = method - self.enctype = enctype + self.enctype = enctype or "application/x-www-form-urlencoded" self.name = name if attrs is not None: self.attrs = attrs.copy() diff --git a/lib/core/option.py b/lib/core/option.py index 35d13fbcf..30aaaec2a 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -457,6 +457,9 @@ def __findPageForms(): if forms: for form in forms: + for control in form.controls: + if hasattr(control, 'items'): + control.items[0].selected = True request = form.click() url = urldecode(request.get_full_url(), kb.pageEncoding) method = request.get_method()