def get_state_link(request, option=None, val='', VALID_OPTIONS=('state', 'user', 'text', 'taskstate')):
 states = []
 val = quote_plus(val)
 assert ((option is None) or (option in VALID_OPTIONS))
 states = dict()
 for o in VALID_OPTIONS:
  if (o in request.GET):
   states[o] = request.GET[o]
 if (option is not None):
  states[option] = val
 return '&'.join([('%s=%s' % (key, quote_plus(value))) for (key, value) in states.iteritems()])

def get_state_link ( request , option = None , val = '' , VALID_OPTIONS = ( 'state' , 'user' , 'text' , 'taskstate' ) ) : states = [ ] val = quote_plus ( val ) assert ( ( option is None ) or ( option in VALID_OPTIONS ) ) states = dict ( ) for o in VALID_OPTIONS : if ( o in request . GET ) : states [ o ] = request . GET [ o ] if ( option is not None ) : states [ option ] = val return '&' . join ( [ ( '%s=%s' % ( key , quote_plus ( value ) ) ) for ( key , value ) in states . iteritems ( ) ] )
constructs the query string for the state of the current query for the jobs page .