aboutsummaryrefslogtreecommitdiff
path: root/src/django_pgpmailman/views/list.py
diff options
context:
space:
mode:
authorJ08nY2017-08-11 20:29:28 +0200
committerJ08nY2017-08-11 20:29:28 +0200
commitb6df3c3cdcb4ca25b48cc316502ec39482afe20e (patch)
treeb52d26b7a08c8aa127ff5ce477ac921dc80e576f /src/django_pgpmailman/views/list.py
parent7b05d2311f3b1727d9567c21f6d9eaac518ef187 (diff)
downloaddjango-pgpmailman-b6df3c3cdcb4ca25b48cc316502ec39482afe20e.tar.gz
django-pgpmailman-b6df3c3cdcb4ca25b48cc316502ec39482afe20e.tar.zst
django-pgpmailman-b6df3c3cdcb4ca25b48cc316502ec39482afe20e.zip
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