示例#1
0
def get_list_with_permission(list_id, user_id):
    try:
        thelist = List.fetch_one(id=list_id, user_id=user_id)
        list_owner = True
    except NoResultFound:
        thelist = FriendList.fetch_one(
            list_id=list_id,
            friend_email=user_id
        )
        list_owner = False
        thelist = List.fetch_one(id=list_id)

    except NoResultFound:
        return flask.abort(403)
    return thelist, list_owner
示例#2
0
def listDeleteView(list_id):
    ''' View to delete a single list
    '''
    try:
        thelist = List.fetch_one(id=list_id, user_id=session['user_id'])
        List.delete(id=thelist.id, user_id=session['user_id'])
        status = 'ok'
    except NoResultFound:
        return flask.abort(403)
    return jsonify({'status': status})