def get_query_without_request(obj_type, username, searchTerm, search_type="global"): """ Builds the query without the request, very similar to the get_query method in the core of crits """ from crits.core.handlers import gen_global_query query = {} response = {} qdict = gen_global_query(obj_type, username, searchTerm, search_type, force_full=False) if not qdict.get('success', True): if qdict.get('ignore', False): response['Result'] = "IGNORE" else: response['Result'] = "ERROR" response['Message'] = qdict.get('error', 'Unable to process query') return response query.update(qdict) results = {} results['Result'] = "OK" results['query'] = query results['term'] = searchTerm return results