def make_search_form(*args, **kwargs):
 request = kwargs.pop('request', None)
 if (request is not None):
  sparams_cookie = request.COOKIES.get('pootle-search')
  if sparams_cookie:
   import json
   import urllib
   try:
    initial_sparams = json.loads(urllib.unquote(sparams_cookie))
   except ValueError:
    pass
   else:
    if (isinstance(initial_sparams, dict) and ('sfields' in initial_sparams)):
     kwargs.update({'initial': initial_sparams})
 return SearchForm(*args, **kwargs)

def make_search_form ( * args , ** kwargs ) : request = kwargs . pop ( 'request' , None ) if ( request is not None ) : sparams_cookie = request . COOKIES . get ( 'pootle-search' ) if sparams_cookie : import json import urllib try : initial_sparams = json . loads ( urllib . unquote ( sparams_cookie ) ) except ValueError : pass else : if ( isinstance ( initial_sparams , dict ) and ( 'sfields' in initial_sparams ) ) : kwargs . update ( { 'initial' : initial_sparams } ) return SearchForm ( * args , ** kwargs )
factory that instantiates one of the search forms below .