@@ -62,7 +62,7 @@ def dispatch(self, *args, **kwargs):
62
62
except UserProfile .DoesNotExist :
63
63
# User is *not* "upload only", all is good
64
64
pass
65
- return super (LoginRequiredMixin , self ).dispatch (* args , ** kwargs )
65
+ return super ().dispatch (* args , ** kwargs )
66
66
67
67
68
68
class SuperUserRequiredMixin (LoginRequiredMixin ):
@@ -74,7 +74,7 @@ def dispatch(self, *args, **kwargs):
74
74
"""Check for login and superuser and dispatch the view."""
75
75
user = self .request .user
76
76
if user .is_superuser :
77
- return super (LoginRequiredMixin , self ).dispatch (* args , ** kwargs )
77
+ return super ().dispatch (* args , ** kwargs )
78
78
else :
79
79
raise PermissionDenied
80
80
@@ -129,7 +129,7 @@ class OrganizationList(RestrictedListView):
129
129
130
130
def get_context_data (self , ** kwargs ):
131
131
"""Setup context for the template."""
132
- context = super (OrganizationList , self ).get_context_data (** kwargs )
132
+ context = super ().get_context_data (** kwargs )
133
133
organization_list = context ['organization_list' ]
134
134
orgs_with_domains = []
135
135
for org in organization_list :
@@ -161,7 +161,7 @@ class ScannerList(RestrictedListView):
161
161
162
162
def get_queryset (self ):
163
163
"""Get queryset, don't include non-visible scanners."""
164
- qs = super (ScannerList , self ).get_queryset ()
164
+ qs = super ().get_queryset ()
165
165
# Dismiss scans that are not visible
166
166
qs = qs .filter (is_visible = True )
167
167
return qs
@@ -176,7 +176,7 @@ class DomainList(RestrictedListView):
176
176
177
177
def get_queryset (self ):
178
178
"""Get queryset, ordered by url followed by primary key."""
179
- query_set = super (DomainList , self ).get_queryset ()
179
+ query_set = super ().get_queryset ()
180
180
181
181
if query_set :
182
182
query_set = query_set .order_by ('url' , 'pk' )
@@ -297,7 +297,7 @@ def form_valid(self, form):
297
297
):
298
298
self .object .group = user_profile .groups .all ()[0 ]
299
299
300
- return super (RestrictedCreateView , self ).form_valid (form )
300
+ return super ().form_valid (form )
301
301
302
302
303
303
class OrgRestrictedMixin (ModelFormMixin , LoginRequiredMixin ):
@@ -348,7 +348,7 @@ def get_form(self, form_class=None):
348
348
349
349
def get_queryset (self ):
350
350
"""Get queryset filtered by user's organization."""
351
- queryset = super (OrgRestrictedMixin , self ).get_queryset ()
351
+ queryset = super ().get_queryset ()
352
352
if not self .request .user .is_superuser :
353
353
organization = None
354
354
@@ -435,7 +435,7 @@ def get_form(self, form_class=None):
435
435
if form_class is None :
436
436
form_class = self .get_form_class ()
437
437
438
- form = super (ScannerCreate , self ).get_form (form_class )
438
+ form = super ().get_form (form_class )
439
439
try :
440
440
organization = self .request .user .profile .organization
441
441
groups = self .request .user .profile .groups .all ()
@@ -499,7 +499,7 @@ def get_form(self, form_class=None):
499
499
form_class = self .get_form_class ()
500
500
501
501
self .fields = self .get_form_fields ()
502
- form = super (ScannerUpdate , self ).get_form (form_class )
502
+ form = super ().get_form (form_class )
503
503
504
504
scanner = self .get_object ()
505
505
@@ -547,7 +547,7 @@ class ScannerAskRun(RestrictedDetailView):
547
547
548
548
def get_context_data (self , ** kwargs ):
549
549
"""Check that user is allowed to run this scanner."""
550
- context = super (ScannerAskRun , self ).get_context_data (** kwargs )
550
+ context = super ().get_context_data (** kwargs )
551
551
552
552
if self .object .has_active_scans :
553
553
ok = False
@@ -601,7 +601,7 @@ def get_form_fields(self):
601
601
The 'validation_status' field will be added to the form if the
602
602
user is a superuser.
603
603
"""
604
- fields = super (DomainCreate , self ).get_form_fields ()
604
+ fields = super ().get_form_fields ()
605
605
if self .request .user .is_superuser :
606
606
fields .append ('validation_status' )
607
607
return fields
@@ -614,7 +614,7 @@ def get_form(self, form_class=None):
614
614
if form_class is None :
615
615
form_class = self .get_form_class ()
616
616
617
- form = super (DomainCreate , self ).get_form (form_class )
617
+ form = super ().get_form (form_class )
618
618
619
619
for fname in form .fields :
620
620
f = form .fields [fname ]
@@ -637,7 +637,7 @@ class DomainUpdate(RestrictedUpdateView):
637
637
638
638
def get_form_fields (self ):
639
639
"""Get the list of form fields."""
640
- fields = super (DomainUpdate , self ).get_form_fields ()
640
+ fields = super ().get_form_fields ()
641
641
642
642
if self .request .user .is_superuser :
643
643
fields .append ('validation_status' )
@@ -653,7 +653,7 @@ def get_form(self, form_class=None):
653
653
if form_class is None :
654
654
form_class = self .get_form_class ()
655
655
656
- form = super (DomainUpdate , self ).get_form (form_class )
656
+ form = super ().get_form (form_class )
657
657
658
658
for fname in form .fields :
659
659
f = form .fields [fname ]
@@ -680,13 +680,13 @@ def form_valid(self, form):
680
680
self .object = form .save (commit = False )
681
681
self .object .organization = user_profile .organization
682
682
683
- result = super (DomainUpdate , self ).form_valid (form )
683
+ result = super ().form_valid (form )
684
684
685
685
return result
686
686
687
687
def get_context_data (self , ** kwargs ):
688
688
"""Get the context used when rendering the template."""
689
- context = super (DomainUpdate , self ).get_context_data (** kwargs )
689
+ context = super ().get_context_data (** kwargs )
690
690
for value , desc in Domain .validation_method_choices :
691
691
key = 'valid_txt_' + str (value )
692
692
context [key ] = get_validation_str (self .object , value )
@@ -712,7 +712,7 @@ class DomainValidate(RestrictedDetailView):
712
712
713
713
def get_context_data (self , ** kwargs ):
714
714
"""Perform validation and populate the template context."""
715
- context = super (DomainValidate , self ).get_context_data (** kwargs )
715
+ context = super ().get_context_data (** kwargs )
716
716
context ['validation_status' ] = self .object .validation_status
717
717
if not self .object .validation_status :
718
718
result = validate_domain (self .object )
@@ -743,7 +743,7 @@ class GroupCreate(RestrictedCreateView):
743
743
744
744
def get_form_fields (self ):
745
745
"""Get the list of fields to use in the form for the view."""
746
- fields = super (GroupCreate , self ).get_form_fields ()
746
+ fields = super ().get_form_fields ()
747
747
748
748
if 'group' in fields :
749
749
fields .remove ('group' )
@@ -760,7 +760,7 @@ def get_form(self, form_class=None):
760
760
if form_class is None :
761
761
form_class = self .get_form_class ()
762
762
763
- form = super (GroupCreate , self ).get_form (form_class )
763
+ form = super ().get_form (form_class )
764
764
765
765
field_name = 'user_profiles'
766
766
queryset = form .fields [field_name ].queryset
@@ -791,7 +791,7 @@ def get_form(self, form_class=None):
791
791
if form_class is None :
792
792
form_class = self .get_form_class ()
793
793
794
- form = super (GroupUpdate , self ).get_form (form_class )
794
+ form = super ().get_form (form_class )
795
795
group = self .get_object ()
796
796
field_name = 'user_profiles'
797
797
queryset = form .fields [field_name ].queryset
@@ -831,7 +831,7 @@ def get_form(self, form_class=None):
831
831
if form_class is None :
832
832
form_class = self .get_form_class ()
833
833
834
- form = super (RuleCreate , self ).get_form (form_class )
834
+ form = super ().get_form (form_class )
835
835
836
836
for fname in form .fields :
837
837
f = form .fields [fname ]
@@ -859,7 +859,7 @@ def get_form(self, form_class=None):
859
859
if form_class is None :
860
860
form_class = self .get_form_class ()
861
861
862
- form = super (RuleUpdate , self ).get_form (form_class )
862
+ form = super ().get_form (form_class )
863
863
864
864
for fname in form .fields :
865
865
f = form .fields [fname ]
@@ -899,7 +899,7 @@ def get_queryset(self):
899
899
If the user is not a superuser the queryset will be limited by the
900
900
user's organization.
901
901
"""
902
- queryset = super (ReportDetails , self ).get_queryset ()
902
+ queryset = super ().get_queryset ()
903
903
if not self .request .user .is_superuser :
904
904
try :
905
905
user_profile = self .request .user .profile
@@ -911,7 +911,7 @@ def get_queryset(self):
911
911
912
912
def get_context_data (self , ** kwargs ):
913
913
"""Add the scan's matches to the report context data."""
914
- context = super (ReportDetails , self ).get_context_data (** kwargs )
914
+ context = super ().get_context_data (** kwargs )
915
915
all_matches = Match .objects .filter (
916
916
scan = self .get_object ()
917
917
).order_by ('-sensitivity' , 'url' , 'matched_rule' , 'matched_data' )
@@ -949,7 +949,7 @@ def get_queryset(self):
949
949
If the user is not a superuser the queryset will be limited by the
950
950
user's organization.
951
951
"""
952
- queryset = super (ReportDelete , self ).get_queryset ()
952
+ queryset = super ().get_queryset ()
953
953
if not self .request .user .is_superuser :
954
954
try :
955
955
user_profile = self .request .user .profile
@@ -1051,7 +1051,7 @@ class DialogSuccess(TemplateView):
1051
1051
1052
1052
def get_context_data (self , ** kwargs ):
1053
1053
"""Setup context for the template."""
1054
- context = super (DialogSuccess , self ).get_context_data (** kwargs )
1054
+ context = super ().get_context_data (** kwargs )
1055
1055
model_type = self .args [0 ]
1056
1056
pk = self .args [1 ]
1057
1057
created = self .args [2 ] == 'created'
@@ -1073,7 +1073,7 @@ class SystemStatusView(TemplateView, SuperUserRequiredMixin):
1073
1073
1074
1074
def get_context_data (self , ** kwargs ):
1075
1075
"""Setup context for the template."""
1076
- context = super (SystemStatusView , self ).get_context_data (** kwargs )
1076
+ context = super ().get_context_data (** kwargs )
1077
1077
all = ConversionQueueItem .objects .filter (
1078
1078
status = ConversionQueueItem .NEW
1079
1079
)
@@ -1134,7 +1134,7 @@ def get_form(self, form_class=None):
1134
1134
if form_class is None :
1135
1135
form_class = self .get_form_class ()
1136
1136
1137
- form = super (SummaryCreate , self ).get_form (form_class )
1137
+ form = super ().get_form (form_class )
1138
1138
1139
1139
field_names = ['recipients' , 'scanners' ]
1140
1140
for field_name in field_names :
@@ -1167,7 +1167,7 @@ def get_form(self, form_class=None):
1167
1167
if form_class is None :
1168
1168
form_class = self .get_form_class ()
1169
1169
1170
- form = super (SummaryUpdate , self ).get_form (form_class )
1170
+ form = super ().get_form (form_class )
1171
1171
summary = self .get_object ()
1172
1172
# Limit recipients to organization
1173
1173
queryset = form .fields ['recipients' ].queryset
@@ -1212,7 +1212,7 @@ class SummaryReport(RestrictedDetailView):
1212
1212
1213
1213
def get_context_data (self , ** kwargs ):
1214
1214
"""Setup context for the template."""
1215
- context = super (SummaryReport , self ).get_context_data (** kwargs )
1215
+ context = super ().get_context_data (** kwargs )
1216
1216
1217
1217
summary = self .object
1218
1218
scan_list , from_date , to_date = scans_for_summary_report (summary )
0 commit comments