def remove_invalid_options(context, search_options, allowed_search_options):
 if context.is_admin:
  for key in ('sort_key', 'sort_dir', 'limit', 'marker'):
   search_options.pop(key, None)
  return
 unknown_options = [opt for opt in search_options if (opt not in allowed_search_options)]
 if unknown_options:
  LOG.debug("Removing options '%s' from query", ', '.join(unknown_options))
  for opt in unknown_options:
   search_options.pop(opt, None)

def remove_invalid_options ( context , search_options , allowed_search_options ) : if context . is_admin : for key in ( 'sort_key' , 'sort_dir' , 'limit' , 'marker' ) : search_options . pop ( key , None ) return unknown_options = [ opt for opt in search_options if ( opt not in allowed_search_options ) ] if unknown_options : LOG . debug ( "Removing options '%s' from query" , ', ' . join ( unknown_options ) ) for opt in unknown_options : search_options . pop ( opt , None )
remove search options that are not valid for non-admin api/context .