1
- # -*- coding: utf-8 -*-
2
1
from django .conf import settings
3
2
from django .contrib import messages
4
3
from django .contrib .auth .decorators import user_passes_test
@@ -19,7 +18,7 @@ class MailListView(TemplateView):
19
18
20
19
def get_context_data (self , ** kwargs ):
21
20
"""Return object_list."""
22
- data = super (MailListView , self ).get_context_data (** kwargs )
21
+ data = super ().get_context_data (** kwargs )
23
22
mail_list = []
24
23
for mail_name , mail_class in sorted (
25
24
factory ._registry .items (), key = lambda x : x [0 ]
@@ -29,7 +28,7 @@ def get_context_data(self, **kwargs):
29
28
return data
30
29
31
30
32
- class MailPreviewMixin ( object ) :
31
+ class MailPreviewMixin :
33
32
def get_html_alternative (self , message ):
34
33
"""Return the html alternative, if present."""
35
34
alternatives = {v : k for k , v in message .alternatives }
@@ -77,10 +76,10 @@ def dispatch(self, request, mail_name):
77
76
self .send = "send" in request .POST
78
77
self .email = request .POST .get ("email" )
79
78
80
- return super (MailFormView , self ).dispatch (request )
79
+ return super ().dispatch (request )
81
80
82
81
def get_form_kwargs (self ):
83
- kwargs = super (MailFormView , self ).get_form_kwargs ()
82
+ kwargs = super ().get_form_kwargs ()
84
83
kwargs ["mail_class" ] = self .mail_class
85
84
return kwargs
86
85
@@ -117,7 +116,7 @@ def form_valid(self, form):
117
116
return HttpResponse (html )
118
117
119
118
def get_context_data (self , ** kwargs ):
120
- data = super (MailFormView , self ).get_context_data (** kwargs )
119
+ data = super ().get_context_data (** kwargs )
121
120
data ["mail_name" ] = self .mail_name
122
121
123
122
preview_messages = {}
@@ -147,10 +146,10 @@ def dispatch(self, request, mail_name, lang):
147
146
except exceptions .MailFactoryError :
148
147
raise Http404
149
148
150
- return super (MailPreviewMessageView , self ).dispatch (request )
149
+ return super ().dispatch (request )
151
150
152
151
def get_context_data (self , ** kwargs ):
153
- data = super (MailPreviewMessageView , self ).get_context_data (** kwargs )
152
+ data = super ().get_context_data (** kwargs )
154
153
message = self .get_mail_preview (self .mail_name , self .lang )
155
154
data ["mail_name" ] = self .mail_name
156
155
data ["message" ] = message
0 commit comments