Skip to content
Snippets Groups Projects
Commit 5c58b27c authored by Piotr Gawron's avatar Piotr Gawron
Browse files

super is called using python 3 syntax

parent e837736b
No related branches found
No related tags found
1 merge request!350Additional pylint checks
Showing
with 39 additions and 39 deletions
......@@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
class CustomStudySubjectFieldViewTests(LoggedInWithWorkerTestCase):
def setUp(self):
super(CustomStudySubjectFieldViewTests, self).setUp()
super().setUp()
self.study = get_test_study()
def test_render_add(self):
......
......@@ -12,7 +12,7 @@ logger = logging.getLogger(__name__)
class StudyViewTests(LoggedInWithWorkerTestCase):
def setUp(self):
super(StudyViewTests, self).setUp()
super().setUp()
self.study = get_test_study()
def test_render_study_edit(self):
......
......@@ -12,7 +12,7 @@ logger = logging.getLogger(__name__)
class VoucherTypePriceViewTests(LoggedInTestCase):
def setUp(self):
super(VoucherTypePriceViewTests, self).setUp()
super().setUp()
self.voucher_type = create_voucher_type()
def test_render_add_voucher_type_price_request(self):
......
......@@ -84,11 +84,11 @@ def extend_context(params, request: HttpRequest):
class WrappedView(ContextMixin):
def get_context_data(self, **kwargs):
context = super(WrappedView, self).get_context_data(**kwargs)
context = super().get_context_data(**kwargs)
return extend_context(context, self.request)
def dispatch(self, *args, **kwargs):
return super(WrappedView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
# pylint: disable=wrong-import-position
......
......@@ -195,8 +195,8 @@ class AppointmentDeleteView(DeleteView, WrappedView):
modified_field = '',
)
p.save()
return super(AppointmentDeleteView, self).delete(request, *args, **kwargs)
return super().delete(request, *args, **kwargs)
@PermissionDecorator('delete_appointment', 'configuration')
def dispatch(self, *args, **kwargs):
return super(AppointmentDeleteView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
......@@ -14,7 +14,7 @@ class AppointmentTypeListView(ListView, WrappedView):
@PermissionDecorator('change_appointmenttype', 'equipment')
def dispatch(self, *args, **kwargs):
return super(AppointmentTypeListView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
class AppointmentTypeCreateView(CreateView, WrappedView):
......@@ -26,7 +26,7 @@ class AppointmentTypeCreateView(CreateView, WrappedView):
@PermissionDecorator('change_appointmenttype', 'equipment')
def dispatch(self, *args, **kwargs):
return super(AppointmentTypeCreateView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
class AppointmentTypeEditView(UpdateView, WrappedView):
......@@ -39,7 +39,7 @@ class AppointmentTypeEditView(UpdateView, WrappedView):
@PermissionDecorator('change_appointmenttype', 'equipment')
def dispatch(self, *args, **kwargs):
return super(AppointmentTypeEditView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
class AppointmentTypeDeleteView(DeleteView, WrappedView):
......@@ -49,8 +49,8 @@ class AppointmentTypeDeleteView(DeleteView, WrappedView):
def delete(self, request, *args, **kwargs):
messages.success(request, "Appointment Type deleted")
return super(AppointmentTypeDeleteView, self).delete(request, *args, **kwargs)
return super().delete(request, *args, **kwargs)
@PermissionDecorator('change_appointmenttype', 'equipment')
def dispatch(self, *args, **kwargs):
return super(AppointmentTypeDeleteView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
......@@ -17,7 +17,7 @@ class LanguageListView(ListView, WrappedView):
@PermissionDecorator('change_language', 'configuration')
def dispatch(self, *args, **kwargs):
return super(LanguageListView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
class LanguageCreateView(CreateView, WrappedView):
model = Language
......@@ -28,7 +28,7 @@ class LanguageCreateView(CreateView, WrappedView):
@PermissionDecorator('change_language', 'configuration')
def dispatch(self, *args, **kwargs):
return super(LanguageCreateView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
class LanguageDeleteView(DeleteView, WrappedView):
model = Language
......@@ -37,11 +37,11 @@ class LanguageDeleteView(DeleteView, WrappedView):
def delete(self, request, *args, **kwargs):
messages.success(request, "Language deleted")
return super(LanguageDeleteView, self).delete(request, *args, **kwargs)
return super().delete(request, *args, **kwargs)
@PermissionDecorator('change_language', 'configuration')
def dispatch(self, *args, **kwargs):
return super(LanguageDeleteView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
class LanguageEditView(UpdateView, WrappedView):
model = Language
......@@ -53,4 +53,4 @@ class LanguageEditView(UpdateView, WrappedView):
@PermissionDecorator('change_language', 'configuration')
def dispatch(self, *args, **kwargs):
return super(LanguageEditView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
......@@ -35,10 +35,10 @@ class MailTemplatesListView(ListView, WrappedView):
@PermissionDecorator('change_mailtemplate', 'mailtemplate')
def dispatch(self, *args, **kwargs):
return super(MailTemplatesListView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
def get_context_data(self, *args, **kwargs):
context = super(MailTemplatesListView, self).get_context_data()
context = super().get_context_data()
context['explanations'] = {"generic": MailTemplate.MAILS_TEMPLATE_GENERIC_TAGS,
"subject": MailTemplate.MAILS_TEMPLATE_SUBJECT_TAGS,
"visit": MailTemplate.MAILS_TEMPLATE_VISIT_TAGS,
......@@ -93,7 +93,7 @@ class MailTemplatesDeleteView(DeleteView, WrappedView):
def delete(self, request, *args, **kwargs):
messages.success(request, "Template deleted")
try:
return super(MailTemplatesDeleteView, self).delete(request, *args, **kwargs)
return super().delete(request, *args, **kwargs)
except:
messages.add_message(request, messages.ERROR, 'There was a problem when deleting template. '
'Contact system administrator.')
......
......@@ -23,7 +23,7 @@ class PrivacyNoticeListView(ListView, WrappedView):
@PermissionDecorator('change_privacynotice', 'privacynotice')
def dispatch(self, *args, **kwargs):
return super(PrivacyNoticeListView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
@PermissionDecorator('change_privacynotice', 'privacynotice')
......@@ -73,7 +73,7 @@ class PrivacyNoticeDeleteView(DeleteView, WrappedView):
@PermissionDecorator('change_privacynotice', 'privacynotice')
def delete(self, request, *args, **kwargs):
messages.success(request, "Privacy Notice deleted")
return super(PrivacyNoticeDeleteView, self).delete(request, *args, **kwargs)
return super().delete(request, *args, **kwargs)
def privacy_notice_accept(request, pk):
......
......@@ -12,4 +12,4 @@ class ProvenanceListView(ListView, WrappedView):
@PermissionDecorator('view_provenance', 'configuration')
def dispatch(self, *args, **kwargs):
return super(ProvenanceListView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
......@@ -78,7 +78,7 @@ class SubjectDeleteView(DeleteView, WrappedView):
def delete(self, request, *args, **kwargs):
messages.success(request, "Subject deleted")
try:
return super(SubjectDeleteView, self).delete(request, *args, **kwargs)
return super().delete(request, *args, **kwargs)
except:
messages.add_message(request, messages.ERROR, 'There was a problem when deleting the subject. '
'Contact system administrator.')
......@@ -103,7 +103,7 @@ class StudySubjectDeleteView(DeleteView, WrappedView):
def delete(self, request, *args, **kwargs):
messages.success(request, "Study Subject deleted")
try:
return super(StudySubjectDeleteView, self).delete(request, *args, **kwargs)
return super().delete(request, *args, **kwargs)
except:
messages.add_message(request, messages.ERROR, 'There was a problem when deleting the Study Subject. '
'Contact system administrator.')
......
......@@ -26,7 +26,7 @@ class VoucherListView(ListView, WrappedView):
@PermissionDecorator('change_voucher', 'configuration')
def dispatch(self, *args, **kwargs):
return super(VoucherListView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
def voucher_types_for_study_subject(study_subject_id):
......@@ -53,20 +53,20 @@ class VoucherCreateView(CreateView, WrappedView):
form.instance.study_id = GLOBAL_STUDY_ID
# noinspection PyUnresolvedReferences
form.instance.study_subject_id = self.request.GET.get("study_subject_id", -1)
return super(VoucherCreateView, self).form_valid(form)
return super().form_valid(form)
def get_success_url(self, **kwargs):
# noinspection PyUnresolvedReferences
return reverse_lazy('web.views.subject_edit', kwargs={'id': self.request.GET.get("study_subject_id", -1)})
def get_form_kwargs(self):
kwargs = super(VoucherCreateView, self).get_form_kwargs()
kwargs = super().get_form_kwargs()
kwargs['voucher_types'] = voucher_types_for_study_subject(self.request.GET.get("study_subject_id", -1))
return kwargs
@PermissionDecorator('change_voucher', 'configuration')
def dispatch(self, *args, **kwargs):
return super(VoucherCreateView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
class VoucherEditView(SuccessMessageMixin, UpdateView, WrappedView):
form_class = VoucherForm
......@@ -85,13 +85,13 @@ class VoucherEditView(SuccessMessageMixin, UpdateView, WrappedView):
return Voucher.objects.get(id=self.kwargs['pk']).study_subject.id
def get_context_data(self, *args, **kwargs):
context = super(VoucherEditView, self).get_context_data(*args, **kwargs)
context = super().get_context_data(*args, **kwargs)
context['mail_templates'] = MailTemplate.get_voucher_mail_templates([])
return context
@PermissionDecorator('change_voucher', 'configuration')
def dispatch(self, *args, **kwargs):
return super(VoucherEditView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
class ExpireVouchersJob(CronJobBase):
......
......@@ -23,7 +23,7 @@ class VoucherPartnerSessionCreateView(CreateView, WrappedView):
def form_valid(self, form):
form.instance.voucher_id = self.kwargs['pk']
response = super(VoucherPartnerSessionCreateView, self).form_valid(form)
response = super().form_valid(form)
voucher = Voucher.objects.get(pk=self.kwargs['pk'])
if voucher.status == VOUCHER_STATUS_NEW:
voucher.status = VOUCHER_STATUS_IN_USE
......
......@@ -17,7 +17,7 @@ class VoucherTypeListView(ListView, WrappedView):
@PermissionDecorator('change_vouchertype', 'configuration')
def dispatch(self, *args, **kwargs):
return super(VoucherTypeListView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
class VoucherTypeCreateView(CreateView, WrappedView):
form_class = VoucherTypeForm
......@@ -29,11 +29,11 @@ class VoucherTypeCreateView(CreateView, WrappedView):
def form_valid(self, form):
form.instance.study_id = GLOBAL_STUDY_ID
return super(VoucherTypeCreateView, self).form_valid(form)
return super().form_valid(form)
@PermissionDecorator('change_vouchertype', 'configuration')
def dispatch(self, *args, **kwargs):
return super(VoucherTypeCreateView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
#@PermissionDecorator('change_vouchertype', 'configuration')
class VoucherTypeEditView(UpdateView, WrappedView):
......@@ -47,4 +47,4 @@ class VoucherTypeEditView(UpdateView, WrappedView):
@PermissionDecorator('change_vouchertype', 'configuration')
def dispatch(self, *args, **kwargs):
return super(VoucherTypeEditView, self).dispatch(*args, **kwargs)
return super().dispatch(*args, **kwargs)
......@@ -22,7 +22,7 @@ class VoucherTypePriceCreateView(CreateView, WrappedView):
def form_valid(self, form):
# noinspection PyUnresolvedReferences
form.instance.voucher_type_id = self.kwargs['voucher_type_id']
return super(VoucherTypePriceCreateView, self).form_valid(form)
return super().form_valid(form)
def get_success_url(self, **kwargs):
# noinspection PyUnresolvedReferences
......
......@@ -14,7 +14,7 @@ class SecuredFileWidget(forms.FileInput):
def __init__(self, attrs=None):
if attrs is None:
attrs = {}
super(SecuredFileWidget, self).__init__(attrs)
super().__init__(attrs)
def render(self, name, value, attrs=None, renderer=None):
output = []
......@@ -22,5 +22,5 @@ class SecuredFileWidget(forms.FileInput):
url = reverse('web.views.uploaded_files') + '?file=' + str(value)
out = '<a href="{}">{}</a><br />{} '
output.append(out.format(url, _('Download'), _('Change:')))
output.append(super(SecuredFileWidget, self).render(name, value, attrs, renderer=renderer))
output.append(super().render(name, value, attrs, renderer=renderer))
return mark_safe(''.join(output))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment