예제 #1
0
def _MockUpdateEvents(data_json):
    """
    test the web url "/update_event" 
    """
    id1, title1, date1, desc1 = Tg1Srvr.get_events_values(data_json, idp='yes')
    sqlx = DBAccess.bld_update_sql(id1, title1, date1, desc1)

    list_result = DBAccess.update_event(sqlx)
    if list_result[0] == 'error':
        sj = {"update_event_error": list_result[1]}
    else:
        sj = {"update_event succeded": list_result[1]}
    print sj
    print "mock_update_event ended"
예제 #2
0
def update_event():
    """
    Update event function
    """
    req = request
    data_json = json.loads(request.args.get('update_data'))
    id1, title1, date1, desc1 = get_events_values(data_json, idp='yes')
    sqlx = DBAccess.bld_update_sql(id1, title1, date1, desc1)

    list_result = DBAccess.update_event(sqlx)
    if list_result[0] == 'error':
        sj = jsonify({"update_event_error": list_result[1]})
    else:
        sj = jsonify({"update_event successeded": list_result[1]})
        rmsg = DBAccess.save_new_diary()
    return sj