mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 04:19:25 +00:00
ruff rules UP008 and UP009
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
# -*- coding:utf-8 -*
|
||||
#
|
||||
# Copyright 2023 © AE UTBM
|
||||
# ae@utbm.fr / ae.info@utbm.fr
|
||||
@ -171,7 +170,7 @@ class FileListView(ListView):
|
||||
return SithFile.objects.filter(parent=None)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(FileListView, self).get_context_data(**kwargs)
|
||||
kwargs = super().get_context_data(**kwargs)
|
||||
kwargs["popup"] = ""
|
||||
if self.kwargs.get("popup") is not None:
|
||||
kwargs["popup"] = "popup"
|
||||
@ -189,7 +188,7 @@ class FileEditView(CanEditMixin, UpdateView):
|
||||
if not self.object.can_be_managed_by(request.user):
|
||||
raise PermissionDenied
|
||||
|
||||
return super(FileEditView, self).get(request, *args, **kwargs)
|
||||
return super().get(request, *args, **kwargs)
|
||||
|
||||
def get_form_class(self):
|
||||
fields = ["name", "is_moderated"]
|
||||
@ -207,7 +206,7 @@ class FileEditView(CanEditMixin, UpdateView):
|
||||
)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(FileEditView, self).get_context_data(**kwargs)
|
||||
kwargs = super().get_context_data(**kwargs)
|
||||
kwargs["popup"] = ""
|
||||
if self.kwargs.get("popup") is not None:
|
||||
kwargs["popup"] = "popup"
|
||||
@ -241,15 +240,15 @@ class FileEditPropView(CanEditPropMixin, UpdateView):
|
||||
if not self.object.can_be_managed_by(request.user):
|
||||
raise PermissionDenied
|
||||
|
||||
return super(FileEditPropView, self).get(request, *args, **kwargs)
|
||||
return super().get(request, *args, **kwargs)
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
form = super(FileEditPropView, self).get_form(form_class)
|
||||
form = super().get_form(form_class)
|
||||
form.fields["parent"].queryset = SithFile.objects.filter(is_folder=True)
|
||||
return form
|
||||
|
||||
def form_valid(self, form):
|
||||
ret = super(FileEditPropView, self).form_valid(form)
|
||||
ret = super().form_valid(form)
|
||||
if form.cleaned_data["recursive"]:
|
||||
self.object.apply_rights_recursively()
|
||||
return ret
|
||||
@ -261,7 +260,7 @@ class FileEditPropView(CanEditPropMixin, UpdateView):
|
||||
)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(FileEditPropView, self).get_context_data(**kwargs)
|
||||
kwargs = super().get_context_data(**kwargs)
|
||||
kwargs["popup"] = ""
|
||||
if self.kwargs.get("popup") is not None:
|
||||
kwargs["popup"] = "popup"
|
||||
@ -321,7 +320,7 @@ class FileView(CanViewMixin, DetailView, FormMixin):
|
||||
|
||||
if "clipboard" not in request.session.keys():
|
||||
request.session["clipboard"] = []
|
||||
return super(FileView, self).get(request, *args, **kwargs)
|
||||
return super().get(request, *args, **kwargs)
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
self.object = self.get_object()
|
||||
@ -339,7 +338,7 @@ class FileView(CanViewMixin, DetailView, FormMixin):
|
||||
):
|
||||
self.form.process(parent=self.object, owner=request.user, files=files)
|
||||
if self.form.is_valid():
|
||||
return super(FileView, self).form_valid(self.form)
|
||||
return super().form_valid(self.form)
|
||||
return self.form_invalid(self.form)
|
||||
|
||||
def get_success_url(self):
|
||||
@ -349,7 +348,7 @@ class FileView(CanViewMixin, DetailView, FormMixin):
|
||||
)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(FileView, self).get_context_data(**kwargs)
|
||||
kwargs = super().get_context_data(**kwargs)
|
||||
kwargs["popup"] = ""
|
||||
kwargs["form"] = self.form
|
||||
if self.kwargs.get("popup") is not None:
|
||||
@ -371,7 +370,7 @@ class FileDeleteView(CanEditPropMixin, DeleteView):
|
||||
if not self.object.can_be_managed_by(request.user):
|
||||
raise PermissionDenied
|
||||
|
||||
return super(FileDeleteView, self).get(request, *args, **kwargs)
|
||||
return super().get(request, *args, **kwargs)
|
||||
|
||||
def get_success_url(self):
|
||||
self.object.file.delete() # Doing it here or overloading delete() is the same, so let's do it here
|
||||
@ -390,7 +389,7 @@ class FileDeleteView(CanEditPropMixin, DeleteView):
|
||||
)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(FileDeleteView, self).get_context_data(**kwargs)
|
||||
kwargs = super().get_context_data(**kwargs)
|
||||
kwargs["popup"] = ""
|
||||
if self.kwargs.get("popup") is not None:
|
||||
kwargs["popup"] = "popup"
|
||||
@ -401,7 +400,7 @@ class FileModerationView(TemplateView):
|
||||
template_name = "core/file_moderation.jinja"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(FileModerationView, self).get_context_data(**kwargs)
|
||||
kwargs = super().get_context_data(**kwargs)
|
||||
kwargs["files"] = SithFile.objects.filter(is_moderated=False)[:100]
|
||||
return kwargs
|
||||
|
||||
|
Reference in New Issue
Block a user