@app.route('/ticket/<ticket_id>/<payload>', methods=['GET', 'POST'])
def ticket_serve(ticket_id, payload):
    t = IngestTicket.load(ticket_id)
    if payload == 'data':
        filename = t['data_md5']
    elif payload == 'bibjson':
        filename = t['data_json']
    elif (payload == 'reset') and (request.method == 'POST'):
        t['state'] =  'new'
        for cleanfield in ('failed_index', 'parse_feedback'):
            if cleanfield in t:
                del t[cleanfield]
        t.save()
        return make_response('OK')
    elif (payload == 'delete') and (request.method == 'POST'):
        t.delete()
        return make_response('OK')
    return redirect('/data/'+filename)
dataset/ETHPy150Open okfn/bibserver/bibserver/ingest.py/ticket_serve/original