def add_activity(activity):
    if not isinstance(activity, Activity):
        return
    status_code = 201
    session = Session()
    try:
        session.add(activity)
    except:
        session.rollback()
        status_code = 409
    finally:
        session.commit()
        id = activity.id
        session.close()
    return status_code, id
Ejemplo n.º 2
0
def add_card(card):
    if not isinstance(card, Card):
        return
    status_code = 201
    session = Session()
    try:
        session.add(card)
    except:
        session.rollback()
        status_code = 409
    finally:
        session.commit()
        id = card.id
        session.close()
    return status_code, id
def add_list(li):
    if not isinstance(li, List):
        return
    status_code = 201
    session = Session()
    try:
        session.add(li)
    except:
        session.rollback()
        status_code = 409
    finally:
        session.commit()
        id = li.id
        session.close()
    return status_code, id
def add_user(user):
    if not isinstance(user, User):
        return None
    status_code = 201
    session = Session()
    try:
        session.add(user)
    except:
        session.rollback()
        status_code = 409
    finally:
        session.commit()
        id = user.id
        session.close()
    return status_code, id