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)
def get_member(List, Member, **kwargs): return Success(Member.dict())
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())
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)
def get_list(List, **kwargs): return Success(List.dict())
def update_list(List, Data, **kwargs): try: List.update_from_dict(Data) except KeyError: return BadRequest('Invalid data.') return Success(List.dict())