blob: 3d0c4272b0acaca6c239dacb29e08d0042e13a48 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
"""
REST root.
/lists/ -> List all known encrypted lists.
/lists/<list_id>/ ->
/lists/<list_id>/key -> GET list_public_key
"""
from mailman.rest.helpers import child
from public import public
from mailman_pgp.rest.addresses import AllAddresses, AnAddress
from mailman_pgp.rest.lists import AllEncryptedLists, AnEncryptedList
@public
class RESTRoot:
@child()
def lists(self, context, segments):
if len(segments) == 0:
return AllEncryptedLists(), []
else:
list_id = segments.pop(0)
return AnEncryptedList(list_id), segments
@child()
def addresses(self, context, segments):
if len(segments) == 0:
return AllAddresses(), []
else:
email = segments.pop(0)
return AnAddress(email), segments
|