예제 #1
0
파일: views.py 프로젝트: atiw003/entrezajax
def elink_and_other(request, other_fn, other_ptr):
    record = EntrezCache.elink(request.entrezajax_developer_registration, **keywords('elink', request.GET))
    # todo: check this is always correct

    id_list = [str(x.values()[0]) for x in record.pop()['LinkSetDb'].pop()['Link']]
    if not id_list:
        response = HttpResponse(mimetype="application/json")
        dump_result(request, response, record)
        return response
        
    id_list_len = len(id_list)
    id_list = paginate(request, id_list)
    logging.info(id_list)
               
    args = keywords(other_fn, request.GET)
    args['id'] = ",".join(id_list)
    logging.info(args)
    return handle_request(request, args, other_fn, other_ptr, {'count' : id_list_len})
예제 #2
0
파일: views.py 프로젝트: atiw003/entrezajax
def esearch_and_other(request, other_fn, other_ptr):
    record = EntrezCache.esearch(request.entrezajax_developer_registration, **keywords('esearch', request.GET))
    logging.info(record)
    if not record["IdList"]:
        response = HttpResponse(mimetype="application/json")
        dump_result(request, response, record)
        return response
    else:
        args = keywords('esummary', request.GET)
        id_list = paginate(request, record["IdList"])
        
        args['id'] = ",".join(id_list)
        logging.info(args)
        return handle_request(request, args, other_fn, other_ptr,
                              {
                               'count' : record["Count"],
                               'retmax' : record["RetMax"]
                              })