From 2e4dc20393c3a678a6576fb20817d4339f66235c Mon Sep 17 00:00:00 2001 From: Claudio Salazar Date: Wed, 26 Jun 2019 21:36:28 +0200 Subject: [PATCH] Add backward compability when method=None in FormRequest --- scrapy/http/request/form.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scrapy/http/request/form.py b/scrapy/http/request/form.py index 8b29aae4b..3ce8fc48e 100644 --- a/scrapy/http/request/form.py +++ b/scrapy/http/request/form.py @@ -18,7 +18,7 @@ from scrapy.utils.response import get_base_url class FormRequest(Request): - valid_form_methods = ['GET', 'POST', 'DIALOG'] + valid_form_methods = ['GET', 'POST'] def __init__(self, *args, **kwargs): formdata = kwargs.pop('formdata', None) @@ -50,9 +50,11 @@ class FormRequest(Request): formdata = _get_inputs(form, formdata, dont_click, clickdata, response) url = _get_form_url(form, kwargs.pop('url', None)) - method = kwargs.pop('method', form.method).upper() - if method not in cls.valid_form_methods: - method = 'GET' + method = kwargs.pop('method', form.method) + if method is not None: + method = method.upper() + if method not in cls.valid_form_methods: + method = 'GET' return cls(url=url, method=method, formdata=formdata, **kwargs)