work around parse_qs behavior in python < 3.11
This commit is contained in:
parent
8e55098458
commit
af18c59623
1 changed files with 6 additions and 0 deletions
|
|
@ -211,6 +211,12 @@ class FieldStorageCompat(Mapping):
|
||||||
"""Emulate the parts of cgi.FieldStorage that we need"""
|
"""Emulate the parts of cgi.FieldStorage that we need"""
|
||||||
|
|
||||||
def __init__(self, environ):
|
def __init__(self, environ):
|
||||||
|
qs = environ.get('QUERY_STRING', '')
|
||||||
|
if not qs:
|
||||||
|
# for python < 3.11, parse_qs will error on a blank string
|
||||||
|
self.data = {}
|
||||||
|
return
|
||||||
|
|
||||||
data = parse_qs(environ.get('QUERY_STRING', ''), strict_parsing=True,
|
data = parse_qs(environ.get('QUERY_STRING', ''), strict_parsing=True,
|
||||||
keep_blank_values=True)
|
keep_blank_values=True)
|
||||||
# replace singleton lists with single values
|
# replace singleton lists with single values
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue