def _MockDeleteEvent(data_json): """ test the web url "/delete_event" """ id1, title1, date1, desc1 = Tg1Srvr.get_events_values(data_json, idp='yes') sqlx = DBAccess.bld_delete_sql(id1, title1, date1, desc1) list_result = DBAccess.delete_event(sqlx) if list_result[0] == 'error': print "MockDeleteEvent: error - {}".format(list_result[1]) else: print "MockDeleteEvent: succeded - {}".format(list_result[1]) return list_result[0]
def delete_event(): """ Delete event function """ req = request data_json = json.loads(request.args.get('delete_data')) id1, title1, date1, desc1 = get_events_values(data_json, idp='yes') sqlx = DBAccess.bld_delete_sql(id1, title1, date1, desc1) list_result = DBAccess.delete_event(sqlx) if list_result[0] == 'error': sj = jsonify({"delete_event_error": list_result[1]}) else: sj = jsonify({"delete_event successeded": list_result[1]}) rmsg = DBAccess.save_new_diary() return sj