def member(self, context, segments, role, email): """Return a single member representation.""" if self._mlist is None: return NotFound(), [] member = getUtility(ISubscriptionService).find_member( email, self._mlist.list_id, role) if member is None: return NotFound(), [] return AMember(member.member_id)
def member(self, request, segments, role, email): """Return a single member representation.""" if self._mlist is None: return NotFound(), [] members = getUtility(ISubscriptionService).find_members( email, self._mlist.list_id, role) if len(members) == 0: return NotFound(), [] assert len(members) == 1, 'Too many matches' return AMember(members[0].member_id)
def members(self, request, segments): """/<api>/members""" if len(segments) == 0: return AllMembers() # Either the next segment is the string "find" or a member id. They # cannot collide. segment = segments.pop(0) if segment == 'find': return FindMembers(), segments else: return AMember(segment), segments
def members(self, context, segments): """/<api>/members""" if len(segments) == 0: return AllMembers() # Either the next segment is the string "find" or a member id. They # cannot collide. segment = segments.pop(0) if segment == 'find': resource = FindMembers() else: try: member_id = self.api.to_uuid(segment) except ValueError: member_id = None resource = AMember(member_id) return resource, segments