""" REST root. /lists/ -> List all known encrypted lists. /lists// -> /lists//key -> GET list_public_key /lists//archive/key -> GET/POST list_archive_public_key /users/ -> List all known users of encrypted lists. /users// -> /users//key -> GET/POST user_public_key """ from mailman.rest.helpers import child from pgpmailman.rest.lists import AllEncryptedLists, AnEncryptedList from pgpmailman.rest.users import AUser, AllUsers from public import public @public class RESTRoot: @child() def lists(self, context, segments): if len(segments) == 0: return AllEncryptedLists(), [] else: list_name = segments.pop(0) # WIP Check whether it's an encrypted list we know of here. return AnEncryptedList(list_name), segments @child() def users(self, context, segments): if len(segments) == 0: return AllUsers(), [] else: uid = segments.pop(0) # WIP Check whether it's an encrypted user we know of here. return AUser(uid), segments