aboutsummaryrefslogtreecommitdiff
path: root/src/django_pgpmailman/views/list.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/django_pgpmailman/views/list.py')
-rw-r--r--src/django_pgpmailman/views/list.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/django_pgpmailman/views/list.py b/src/django_pgpmailman/views/list.py
index 0c0f367..b99e332 100644
--- a/src/django_pgpmailman/views/list.py
+++ b/src/django_pgpmailman/views/list.py
@@ -18,6 +18,8 @@
from __future__ import absolute_import, unicode_literals
+from django.core.files.base import ContentFile
+from django.http import HttpResponse
from django.shortcuts import render
from django_pgpmailman.plugin import get_pgp_plugin
@@ -26,3 +28,19 @@ from django_pgpmailman.plugin import get_pgp_plugin
def pgp_list_index(request):
return render(request, 'django_pgpmailman/index.html',
{'lists': get_pgp_plugin().lists})
+
+
+def pgp_list_summary(request, list_id):
+ return render(request, 'django_pgpmailman/summary.html',
+ {'pgp_list': get_pgp_plugin().get_list(list_id)})
+
+
+def pgp_list_pubkey(request, list_id):
+ pgp_list = get_pgp_plugin().get_list(list_id)
+ pubkey = pgp_list.pubkey
+ pubkey_file = ContentFile(str(pubkey))
+ response = HttpResponse(pubkey_file, 'application/pgp-keys')
+ response['Content-Length'] = pubkey_file.size
+ response[
+ 'Content-Disposition'] = 'attachment; filename="%s.asc"' % pgp_list.list_id
+ return response