@logic.validate(logic.schema.default_autocomplete_schema)
def user_autocomplete(context, data_dict):
 model = context['model']
 user = context['user']
 _check_access('user_autocomplete', context, data_dict)
 q = data_dict['q']
 limit = data_dict.get('limit', 20)
 query = model.User.search(q)
 query = query.filter((model.User.state != model.State.DELETED))
 query = query.limit(limit)
 user_list = []
 for user in query.all():
  result_dict = {}
  for k in ['id', 'name', 'fullname']:
   result_dict[k] = getattr(user, k)
  user_list.append(result_dict)
 return user_list

@ logic . validate ( logic . schema . default_autocomplete_schema ) def user_autocomplete ( context , data_dict ) : model = context [ 'model' ] user = context [ 'user' ] _check_access ( 'user_autocomplete' , context , data_dict ) q = data_dict [ 'q' ] limit = data_dict . get ( 'limit' , 20 ) query = model . User . search ( q ) query = query . filter ( ( model . User . state != model . State . DELETED ) ) query = query . limit ( limit ) user_list = [ ] for user in query . all ( ) : result_dict = { } for k in [ 'id' , 'name' , 'fullname' ] : result_dict [ k ] = getattr ( user , k ) user_list . append ( result_dict ) return user_list
return a list of user names that contain a string .