def __validate_give_loan_form():

    error = None

    # fetch values and check they are actually provided
    if 'user' in request.form: to_user = request.form['user']
    else: error = 'You need to specify to whom to loan'
    if 'date' in request.form: date = request.form['date']
    else: error = 'You need to provide a date'
    if 'deduct_from' in request.form: deduct_from_account = request.form['deduct_from']
    else: error = 'You need to provide an account to deduct from'
    if 'amount' in request.form: amount = request.form['amount']
    else: error = 'You need to provide an amount'
    if 'description' in request.form and request.form['description']: description = request.form['description']
    else: error = 'You need to provide a description'

    return locals()
Simple validate add/edit give loan entry form
dataset/ETHPy150Open radekstepan/FlaskBudget/presenters/loans.py/__validate_give_loan_form