#NEWLINE# def _parse_qsl( qs , keep_blank_values = False , strict_parsing = False , encoding = 'utf-8' , errors = 'replace' ) : #NEWLINE# #INDENT# ( qs , _coerce_result ) = ( qs , unicode ) #NEWLINE# pairs = [ s2 for s1 in qs . split ( '&' ) for s2 in s1 . split ( ';' ) ] #NEWLINE# r = [ ] #NEWLINE# for name_value in pairs : #NEWLINE# #INDENT# if ( ( not name_value ) and ( not strict_parsing ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# nv = name_value . split ( '=' , 1 ) #NEWLINE# if ( len ( nv ) != 2 ) : #NEWLINE# #INDENT# if strict_parsing : #NEWLINE# #INDENT# raise ValueError ( ( 'bad query field: %r' % ( name_value , ) ) ) #NEWLINE# #UNINDENT# if keep_blank_values : #NEWLINE# #INDENT# nv . append ( '' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( nv [ 1 ] ) or keep_blank_values ) : #NEWLINE# #INDENT# name = nv [ 0 ] . replace ( '+' , ' ' ) #NEWLINE# name = compat_urllib_parse_unquote ( name , encoding = encoding , errors = errors ) #NEWLINE# name = _coerce_result ( name ) #NEWLINE# value = nv [ 1 ] . replace ( '+' , ' ' ) #NEWLINE# value = compat_urllib_parse_unquote ( value , encoding = encoding , errors = errors ) #NEWLINE# value = _coerce_result ( value ) #NEWLINE# r . append ( ( name , value ) ) #NEWLINE# #UNINDENT# #UNINDENT# return r