Esempio n. 1
0
def link_ref(pmid):
    try:
        check_for_other_users(current_user.name)
        if request.method == "POST":
            tasks = check_form_validity_and_convert_to_tasks(request.form)
            model.execute(link_paper(pmid, tasks), current_user.name, commit=True)
            
            #Link successful
            summary = model.execute(get_ref_summary(pmid), current_user.name)
            flash("Reference for pmid = " + pmid + " has been added into the database and associated with the following data:<br>" + str(summary), 'success')
    
    except Exception as e:
        flash(e.message, 'error')

    return redirect(request.args.get("next") or url_for("reference"))
Esempio n. 2
0
def link_ref(pmid):
    log_it_info('link_ref', 'BEGIN', str(pmid))
    response = ""
    try:
        check_for_other_users(current_user.name)
        log_it('check_for_other_users', 'SUCCESS')
        
        #if request.method == "POST":
        tasks = check_form_validity_and_convert_to_tasks(request.form) 
        log_it('check_form_validity_and_convert_to_tasks', 'SUCCESS', str(tasks))

        model.execute(link_paper(pmid, tasks), current_user.name, commit=True)   
        log_it('link_paper', 'SUCCESS')
            
        #Link successful
        summary = model.execute(get_ref_summary(pmid), current_user.name)  
        response = summary
        log_it_info('link_ref', 'SUCCESS')
    except Exception as e: 
        response = "Error:<br>" + e.message;
        log_it_info('link_ref', 'FAILURE')
    return response