Example #1
0
def add_new_person2List(profile, db, List):
    try:
        new_user = List(profile['firstname'] + ' ' + profile['lastname'], profile['email'], profile['check_in'], profile['public_tag'],
                        profile['event_id'])
        db.session.add(new_user)
        DBlog.logging('log/List.log', 'add', profile)
        db.session.commit()
        return 'new person added\n'
    except:
        db.session.rollback()
        return 'some error happened, rollback\n'
Example #2
0
def add_new_person2List(profile, db, List):
    try:
        new_user = List(profile['firstname'] + ' ' + profile['lastname'],
                        profile['email'], profile['check_in'],
                        profile['public_tag'], profile['event_id'])
        db.session.add(new_user)
        DBlog.logging('log/List.log', 'add', profile)
        db.session.commit()
        return 'new person added\n'
    except:
        db.session.rollback()
        return 'some error happened, rollback\n'
Example #3
0
def update_person_in_List(user, profile, db):
    try:
        DBlog.logging('log/List.log', 'update', profile, user)
        user.Name = profile['firstname'] + ' ' + profile['lastname']
        user.CheckIn = profile['check_in']
        user.PublicTag = profile['public_tag']
        user.EventID = profile['event_id']
        user.SessionID = profile['session_id']
        db.session.commit()
        return 'information updated\n'
    except:
        db.session.rollback()
        return 'some error happened, rollback\n'
Example #4
0
def update_person_in_List(user, profile, db):
    try:
        DBlog.logging('log/List.log', 'update', profile, user)
        user.Name = profile['firstname'] + ' ' + profile['lastname']
        user.CheckIn = profile['check_in']
        user.PublicTag = profile['public_tag']
        user.EventID = profile['event_id']
        user.SessionID = profile['session_id']
        db.session.commit()
        return 'information updated\n'
    except:
        db.session.rollback()
        return 'some error happened, rollback\n'
Example #5
0
def reset_List():
    DBoperations.init_List()
    DBoperations.init_event()
    DBoperations.init_session()
    DBlog.reset_logging('log/List.log')
    return 'Successfully reset\n'
Example #6
0
    # add a new person to database
    if user == None:
        new_user = List(name, email, check_in, public_tag, event_id)
        db.session.add(new_user)
        db.session.commit()
        return 'new person added\n'

    # update the person's information
    else:
        user.CheckIn = check_in
        user.PublicTag = public_tag
        user.EventID = event_id
        db.session.commit()
        return 'infomation updated\n'


# the main page
@application.route('/')
def index():
    return render_template('main.html')


if __name__ == "__main__":
    DBlog.init_logging()
    application.run(host='0.0.0.0')

# curl --data "name=denisehills&[email protected]&check_in=1&public_tag=1&event_id=1" http://54.175.39.137:5000/post/
# curl --data "lastname=Hills&firstname=Denise&recommendation_num=2&rate=5" http://54.175.39.137:5000/feedback/
# curl "http://54.175.39.137:5000/r/get/[email protected]&event_id=1&lastname=Hills&firstname=Denise"
# curl "http://54.175.39.137:5000/p/get/?lastname=Hills&firstname=Denise&[email protected]"
Example #7
0
def reset_List():
    DBoperations.init_List()
    DBoperations.init_event()
    DBoperations.init_session()
    DBlog.reset_logging('log/List.log')
    return 'Successfully reset\n'
Example #8
0
    # add a new person to database
    if user == None:
        new_user = List(name, email, check_in, public_tag, event_id)
        db.session.add(new_user)
        db.session.commit()
        return 'new person added\n'

    # update the person's information
    else:
        user.CheckIn = check_in
        user.PublicTag = public_tag
        user.EventID = event_id
        db.session.commit()
        return 'infomation updated\n'


# the main page
@application.route('/')
def index():
    return render_template('main.html')


if __name__ == "__main__":
    DBlog.init_logging()
    application.run(host='0.0.0.0')

# curl --data "name=denisehills&[email protected]&check_in=1&public_tag=1&event_id=1" http://54.175.39.137:5000/post/
# curl --data "lastname=Hills&firstname=Denise&recommendation_num=2&rate=5" http://54.175.39.137:5000/feedback/
# curl "http://54.175.39.137:5000/r/get/[email protected]&event_id=1&lastname=Hills&firstname=Denise"
# curl "http://54.175.39.137:5000/p/get/?lastname=Hills&firstname=Denise&[email protected]"