Skip to content

Commit

Permalink
Fix/obligee action code clean (#437)
Browse files Browse the repository at this point in the history
* Remove unused import

* Fix PEP8 errors: blank lines between classes

* Fix PEP8 errors: fix indentation
  • Loading branch information
karol-bujacek authored Dec 12, 2023
1 parent 42a2890 commit 24cc251
Showing 1 changed file with 46 additions and 12 deletions.
58 changes: 46 additions & 12 deletions chcemvediet/apps/inforequests/forms/obligee_action.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# vim: expandtab
# -*- coding: utf-8 -*-
from dateutil.relativedelta import relativedelta

from django import forms
from django.core.exceptions import ValidationError
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand All @@ -203,6 +205,7 @@ def post_transition(self):

return res


class DisclosureLevelFork(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -218,6 +221,7 @@ def pre_transition(self):

return res


class CanAddDisclosure(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -233,6 +237,7 @@ def pre_transition(self):

return res


class CanAddExtension(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -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'
Expand Down Expand Up @@ -311,6 +317,7 @@ def post_transition(self):

return res


class CanAddAdvancement(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand All @@ -420,6 +429,7 @@ def post_transition(self):

return res


class CanAddRefusal(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -527,6 +540,7 @@ def post_transition(self):

return res


class CanAddDisclosureRefusalAdvancementOrExtension(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -592,6 +608,7 @@ def post_transition(self):

return res


class AppealDisclosureLevelFork(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -611,6 +628,7 @@ def pre_transition(self):

return res


class CanAddReversion(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -626,6 +644,7 @@ def pre_transition(self):

return res


class CanAddRemandment(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -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'
Expand Down Expand Up @@ -672,6 +692,7 @@ def post_transition(self):

return res


class CanAddAffirmation(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -770,6 +794,7 @@ def post_transition(self):

return res


class CanAddRemandmentAffirmationOrReversion(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -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'
Expand Down Expand Up @@ -820,6 +846,7 @@ def post_transition(self):

return res


class CanAddConfirmation(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -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'
Expand Down Expand Up @@ -866,6 +894,7 @@ def post_transition(self):

return res


class CanAddClarificationRequest(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -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'
Expand Down Expand Up @@ -943,6 +973,7 @@ def deferred(draft):
attachment.generic_object = draft
attachment.save()


class IsByEmail(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -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'
Expand All @@ -971,6 +1003,7 @@ def add_fields(self):
inforequest=self.wizard.inforequest,
)


class HasSingeBranch(ObligeeActionStep):

def pre_transition(self):
Expand All @@ -986,6 +1019,7 @@ def pre_transition(self):

# Wizard


class ObligeeActionWizard(Wizard):
first_step_class = HasSingeBranch

Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 24cc251

Please sign in to comment.