Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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