aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJ08nY2017-08-15 17:41:13 +0200
committerJ08nY2017-08-15 17:41:13 +0200
commit70cf9c14f3fd756bd40e848919d253d3e9b8fc44 (patch)
tree16e3a5ae8fea47e7851ffd1ddb499afa5dcf3daf /src
parentba165c597fb7d7407eea609eeaff115c99645c6d (diff)
downloaddjango-pgpmailman-70cf9c14f3fd756bd40e848919d253d3e9b8fc44.tar.gz
django-pgpmailman-70cf9c14f3fd756bd40e848919d253d3e9b8fc44.tar.zst
django-pgpmailman-70cf9c14f3fd756bd40e848919d253d3e9b8fc44.zip
Diffstat (limited to 'src')
-rw-r--r--src/django_pgpmailman/forms.py2
-rw-r--r--src/django_pgpmailman/templates/django_pgpmailman/list/encryption_settings.html4
-rw-r--r--src/django_pgpmailman/urls.py6
-rw-r--r--src/django_pgpmailman/views/list.py62
4 files changed, 56 insertions, 18 deletions
diff --git a/src/django_pgpmailman/forms.py b/src/django_pgpmailman/forms.py
index bba8e41..17b5380 100644
--- a/src/django_pgpmailman/forms.py
+++ b/src/django_pgpmailman/forms.py
@@ -50,7 +50,7 @@ class ListSignatureSettingsForm(forms.Form):
'Whether to sign the outgoing postings of a mailing list'
'by the list key.')
)
- strip_original_signature = forms.NullBooleanField(
+ strip_original_sig = forms.NullBooleanField(
widget=NullBooleanRadioSelect(choices=boolean_choices),
required=False,
label=_('Strip sender signature'),
diff --git a/src/django_pgpmailman/templates/django_pgpmailman/list/encryption_settings.html b/src/django_pgpmailman/templates/django_pgpmailman/list/encryption_settings.html
index 4e54afc..37b03be 100644
--- a/src/django_pgpmailman/templates/django_pgpmailman/list/encryption_settings.html
+++ b/src/django_pgpmailman/templates/django_pgpmailman/list/encryption_settings.html
@@ -1,5 +1,6 @@
{% extends "django_pgpmailman/base.html" %}
{% load i18n %}
+{% load bootstrap_tags %}
{% block head_title %}
{% trans 'PGP List' %} - {{ block.super }}
@@ -7,7 +8,8 @@
{% block content %}
{% with mlist=pgp_list.mlist %}
- {% include 'django_pgpmailman/list/nav.html' with nav_tab='encryption_settings' nav_title='Encryption settings'%}
+ {% include 'django_pgpmailman/list/nav.html' with nav_tab='encryption_settings' nav_title='Encryption settings' %}
+ {% bootstrap_form_horizontal form 3 8 'Save changes' %}
{% endwith %}
{% endblock content %}
diff --git a/src/django_pgpmailman/urls.py b/src/django_pgpmailman/urls.py
index a5620f1..6a2df63 100644
--- a/src/django_pgpmailman/urls.py
+++ b/src/django_pgpmailman/urls.py
@@ -21,15 +21,15 @@ from django.conf.urls import url, include
from django_pgpmailman.views.list import (
pgp_list_index, pgp_list_summary, pgp_list_pubkey, pgp_list_key_management,
- pgp_list_signature_settings, pgp_list_encryption_settings)
+ ListSignatureSettingsView, ListEncryptionSettingsView)
from django_pgpmailman.views.user import pgp_user_profile
list_patterns = [
url(r'^$', pgp_list_summary, name='pgp_list_summary'),
url(r'^key/$', pgp_list_key_management, name='pgp_list_key_management'),
- url(r'^signatures/$', pgp_list_signature_settings,
+ url(r'^signatures/$', ListSignatureSettingsView.as_view(),
name='pgp_list_signature_settings'),
- url(r'^encryption/$', pgp_list_encryption_settings,
+ url(r'^encryption/$', ListEncryptionSettingsView.as_view(),
name='pgp_list_encryption_settings'),
url(r'^pubkey$', pgp_list_pubkey, name='pgp_list_pubkey')
]
diff --git a/src/django_pgpmailman/views/list.py b/src/django_pgpmailman/views/list.py
index 680a1e7..e5a7e8a 100644
--- a/src/django_pgpmailman/views/list.py
+++ b/src/django_pgpmailman/views/list.py
@@ -24,9 +24,11 @@ from django.http import HttpResponse
from django.shortcuts import render
from django.utils.decorators import method_decorator
from django.views.generic import FormView
+from six.moves.urllib.error import HTTPError
from django_pgpmailman.decorators import list_view
-from django_pgpmailman.forms import ListSignatureSettingsForm
+from django_pgpmailman.forms import (ListSignatureSettingsForm,
+ ListEncryptionSettingsForm)
from django_pgpmailman.plugin import get_pgp_plugin
@@ -42,29 +44,63 @@ def pgp_list_summary(request, pgp_list):
{'pgp_list': pgp_list})
-@method_decorator(login_required, name='dispatch')
-@method_decorator(list_view, name='dispatch')
-class ListSignatureSettingsView(FormView):
+# TODO: proper list owner auth
+class ListSettings(FormView):
+ properties = None
+
+ def get_initial(self):
+ result = {}
+ for key in self.properties:
+ result[key] = getattr(self.pgp_list, key, None)
+ return result
+
+ def get_context_data(self, **kwargs):
+ data = super(ListSettings, self).get_context_data(
+ **kwargs)
+ data['pgp_list'] = self.pgp_list
+ data['mlist'] = self.pgp_list.mlist
+ return data
+
+ @method_decorator(login_required)
+ def dispatch(self, request, *args, **kwargs):
+ self.pgp_list = get_pgp_plugin().get_list(kwargs['list_id'])
+ return super(ListSettings, self).dispatch(request, *args, **kwargs)
+
+
+class ListSignatureSettingsView(ListSettings):
form_class = ListSignatureSettingsForm
template_name = 'django_pgpmailman/list/signature_settings.html'
+ properties = ('sign_outgoing', 'strip_original_sig', 'unsigned_msg_action',
+ 'inline_pgp_action', 'expired_sig_action',
+ 'revoked_sig_action', 'invalid_sig_action',
+ 'duplicate_sig_action')
def form_valid(self, form):
- pass
+ try:
+ pass
+ except HTTPError as e:
+ pass
-# TODO: proper list owner auth
-@login_required
-@list_view
-def pgp_list_key_management(request, pgp_list):
- return render(request, 'django_pgpmailman/list/key_management.html',
- {'pgp_list': pgp_list})
+
+class ListEncryptionSettingsView(ListSettings):
+ form_class = ListEncryptionSettingsForm
+ template_name = 'django_pgpmailman/list/encryption_settings.html'
+ properties = ('nonencrypted_msg_action', 'encrypt_outgoing')
+
+ def form_valid(self, form):
+ try:
+
+ pass
+ except HTTPError as e:
+ pass
# TODO: proper list owner auth
@login_required
@list_view
-def pgp_list_encryption_settings(request, pgp_list):
- return render(request, 'django_pgpmailman/list/encryption_settings.html',
+def pgp_list_key_management(request, pgp_list):
+ return render(request, 'django_pgpmailman/list/key_management.html',
{'pgp_list': pgp_list})