def parse_get_vars(environ):
"""Takes the QUERY_STRING and unpacks it to get_vars"""
# Ref: https://docs.python.org/2/library/cgi.html#cgi.parse_qs
query_string = environ.get('QUERY_STRING', '')
dget = urlparse.parse_qs(query_string, keep_blank_values=1)
get_vars = Storage(dget)
for (key, value) in get_vars.iteritems():
if isinstance(value, list) and len(value) == 1:
get_vars[key] = value[0]
return get_vars
评论列表
文章目录