From 24cc251daaa06964303ed69e06b34f08bf9db06f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Buja=C4=8Dek?= Date: Tue, 12 Dec 2023 20:40:49 +0100 Subject: [PATCH] Fix/obligee action code clean (#437) * Remove unused import * Fix PEP8 errors: blank lines between classes * Fix PEP8 errors: fix indentation --- .../apps/inforequests/forms/obligee_action.py | 58 +++++++++++++++---- 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/chcemvediet/apps/inforequests/forms/obligee_action.py b/chcemvediet/apps/inforequests/forms/obligee_action.py index e4a986c8f..2c1ba49e9 100644 --- a/chcemvediet/apps/inforequests/forms/obligee_action.py +++ b/chcemvediet/apps/inforequests/forms/obligee_action.py @@ -1,6 +1,5 @@ # vim: expandtab # -*- coding: utf-8 -*- -from dateutil.relativedelta import relativedelta from django import forms from django.core.exceptions import ValidationError @@ -27,6 +26,7 @@ class ObligeeActionStep(Step): # Epilogue + class Categorized(ObligeeActionStep): label = _(u'inforequests:obligee_action:Categorized:label') text_template = u'inforequests/obligee_action/texts/categorized.html' @@ -123,6 +123,7 @@ def clean(self): return cleaned_data + class NotCategorized(ObligeeActionStep): label = _(u'inforequests:obligee_action:NotCategorized:label') text_template = u'inforequests/obligee_action/texts/not_categorized.html' @@ -182,6 +183,7 @@ def post_transition(self): # Pre Appeal + class DisclosureReasons(ObligeeActionStep): label = _(u'inforequests:obligee_action:DisclosureReasons:label') text_template = u'inforequests/obligee_action/texts/disclosure_reasons.html' @@ -203,6 +205,7 @@ def post_transition(self): return res + class DisclosureLevelFork(ObligeeActionStep): def pre_transition(self): @@ -218,6 +221,7 @@ def pre_transition(self): return res + class CanAddDisclosure(ObligeeActionStep): def pre_transition(self): @@ -233,6 +237,7 @@ def pre_transition(self): return res + class CanAddExtension(ObligeeActionStep): def pre_transition(self): @@ -250,6 +255,7 @@ def pre_transition(self): return res + class IsItExtension(ObligeeActionStep): label = _(u'inforequests:obligee_action:IsItExtension:label') text_template = u'inforequests/obligee_action/texts/is_extension.html' @@ -311,6 +317,7 @@ def post_transition(self): return res + class CanAddAdvancement(ObligeeActionStep): def pre_transition(self): @@ -328,6 +335,7 @@ def pre_transition(self): return res + class IsItAdvancement(ObligeeActionStep): label = _(u'inforequests:obligee_action:IsItAdvancement:label') text_template = u'inforequests/obligee_action/texts/is_advancement.html' @@ -399,6 +407,7 @@ def post_transition(self): return res + class RefusalReasons(ObligeeActionStep): label = _(u'inforequests:obligee_action:RefusalReasons:label') text_template = u'inforequests/obligee_action/texts/refusal_reasons.html' @@ -420,6 +429,7 @@ def post_transition(self): return res + class CanAddRefusal(ObligeeActionStep): def pre_transition(self): @@ -435,6 +445,7 @@ def pre_transition(self): return res + class IsItDecision(ObligeeActionStep): label = _(u'inforequests:obligee_action:IsItDecision:label') text_template = u'inforequests/obligee_action/texts/is_decision.html' @@ -464,6 +475,7 @@ def post_transition(self): return res + class ContainsInfo(ObligeeActionStep): label = _(u'inforequests:obligee_action:ContainsInfo:label') text_template = u'inforequests/obligee_action/texts/contains_info.html' @@ -498,6 +510,7 @@ def post_transition(self): return res + class IsOnTopic(ObligeeActionStep): label = _(u'inforequests:obligee_action:IsOnTopic:label') text_template = u'inforequests/obligee_action/texts/is_on_topic.html' @@ -527,6 +540,7 @@ def post_transition(self): return res + class CanAddDisclosureRefusalAdvancementOrExtension(ObligeeActionStep): def pre_transition(self): @@ -544,6 +558,7 @@ def pre_transition(self): # Post Appeal + class InvalidReversion(ObligeeActionStep): label = _(u'inforequests:obligee_action:InvalidReversion:label') text_template = u'inforequests/obligee_action/texts/invalid_reversion.html' @@ -570,6 +585,7 @@ def post_transition(self): return res + class ReversionReasons(ObligeeActionStep): label = _(u'inforequests:obligee_action:ReversionReasons:label') text_template = u'inforequests/obligee_action/texts/reversion_reasons.html' @@ -592,6 +608,7 @@ def post_transition(self): return res + class AppealDisclosureLevelFork(ObligeeActionStep): def pre_transition(self): @@ -611,6 +628,7 @@ def pre_transition(self): return res + class CanAddReversion(ObligeeActionStep): def pre_transition(self): @@ -626,6 +644,7 @@ def pre_transition(self): return res + class CanAddRemandment(ObligeeActionStep): def pre_transition(self): @@ -643,6 +662,7 @@ def pre_transition(self): return res + class WasItReturned(ObligeeActionStep): label = _(u'inforequests:obligee_action:WasItReturned:label') text_template = u'inforequests/obligee_action/texts/was_returned.html' @@ -672,6 +692,7 @@ def post_transition(self): return res + class CanAddAffirmation(ObligeeActionStep): def pre_transition(self): @@ -689,6 +710,7 @@ def pre_transition(self): return res + class WasItAccepted(ObligeeActionStep): label = _(u'inforequests:obligee_action:WasItAccepted:label') text_template = u'inforequests/obligee_action/texts/was_accepted.html' @@ -718,6 +740,7 @@ def post_transition(self): return res + class ContainsAppealInfo(ObligeeActionStep): label = _(u'inforequests:obligee_action:ContainsAppealInfo:label') text_template = u'inforequests/obligee_action/texts/contains_appeal_info.html' @@ -741,6 +764,7 @@ def add_fields(self): widget=forms.RadioSelect(), ) + class IsItAppealDecision(ObligeeActionStep): label = _(u'inforequests:obligee_action:IsItAppealDecision:label') text_template = u'inforequests/obligee_action/texts/is_appeal_decision.html' @@ -770,6 +794,7 @@ def post_transition(self): return res + class CanAddRemandmentAffirmationOrReversion(ObligeeActionStep): def pre_transition(self): @@ -789,6 +814,7 @@ def pre_transition(self): # Confirmation and Clarification Request + class IsItConfirmation(ObligeeActionStep): label = _(u'inforequests:obligee_action:IsItConfirmation:label') text_template = u'inforequests/obligee_action/texts/is_confirmation.html' @@ -820,6 +846,7 @@ def post_transition(self): return res + class CanAddConfirmation(ObligeeActionStep): def pre_transition(self): @@ -835,6 +862,7 @@ def pre_transition(self): return res + class IsItQuestion(ObligeeActionStep): label = _(u'inforequests:obligee_action:IsItQuestion:label') text_template = u'inforequests/obligee_action/texts/is_question.html' @@ -866,6 +894,7 @@ def post_transition(self): return res + class CanAddClarificationRequest(ObligeeActionStep): def pre_transition(self): @@ -883,6 +912,7 @@ def pre_transition(self): # Prologue + class InputBasics(ObligeeActionStep): label = _(u'inforequests:obligee_action:InputBasics:label') text_template = u'inforequests/obligee_action/texts/basics.html' @@ -943,6 +973,7 @@ def deferred(draft): attachment.generic_object = draft attachment.save() + class IsByEmail(ObligeeActionStep): def pre_transition(self): @@ -957,6 +988,7 @@ def pre_transition(self): return res + class SelectBranch(ObligeeActionStep): label = _(u'inforequests:obligee_action:SelectBranch:label') text_template = u'inforequests/obligee_action/texts/branch.html' @@ -971,6 +1003,7 @@ def add_fields(self): inforequest=self.wizard.inforequest, ) + class HasSingeBranch(ObligeeActionStep): def pre_transition(self): @@ -986,6 +1019,7 @@ def pre_transition(self): # Wizard + class ObligeeActionWizard(Wizard): first_step_class = HasSingeBranch @@ -1000,7 +1034,7 @@ def get_instance_id(self): def get_step_url(self, step, anchor=u''): return reverse(u'inforequests:obligee_action', - kwargs=dict(inforequest=self.inforequest, step=step)) + anchor + kwargs=dict(inforequest=self.inforequest, step=step)) + anchor def context(self, extra=None): res = super(ObligeeActionWizard, self).context(extra) @@ -1055,16 +1089,16 @@ def finish_action(self): def finish_help(self): msg = render_mail(u'inforequests/mails/obligee_action_help_request', - from_email=settings.DEFAULT_FROM_EMAIL, - to=[settings.SUPPORT_EMAIL], - attachments=[(a.name, a.content, a.content_type) - for a in self.values[u'attachments'] or []], - dictionary={ - u'wizard': self, - u'inforequest': self.inforequest, - u'email': self.email, - }, - ) + from_email=settings.DEFAULT_FROM_EMAIL, + to=[settings.SUPPORT_EMAIL], + attachments=[(a.name, a.content, a.content_type) + for a in self.values[u'attachments'] or []], + dictionary={ + u'wizard': self, + u'inforequest': self.inforequest, + u'email': self.email, + }, + ) msg.send() if self.email: