Esempio n. 1
0
def delete_member(List, Member, **kwargs):
    try:
        List.remove_member(Member)
    except NotSubscribed:
        # The require_member decorator already checked that the member was
        # subscribed, so if we got here, something's very broken.
        return InternalServerError
    return Success(code=204)
Esempio n. 2
0
def get_member(List, Member, **kwargs):
    return Success(Member.dict())
Esempio n. 3
0
def update_member(List, Member, Data, **kwargs):
    try:
        List.update_member_from_dict(Member, Data)
    except KeyError:
        return BadRequest('Invalid data.')
    return Success(Member.dict())
Esempio n. 4
0
def invite_member(List, MemberAddress, **kwargs):
    try:
        List.invite_subscribe_member(MemberAddress)
    except AlreadySubscribed:
        return BadRequest('{} is already subscribed.'.format(MemberAddress))
    return Success(code=204)
Esempio n. 5
0
def get_list(List, **kwargs):
    return Success(List.dict())
Esempio n. 6
0
def update_list(List, Data, **kwargs):
    try:
        List.update_from_dict(Data)
    except KeyError:
        return BadRequest('Invalid data.')
    return Success(List.dict())