Skip to content

Commit 29d3593

Browse files
committed
Refactor base use case class to really become an abstract base class
1 parent ea483a4 commit 29d3593

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

sponsors/use_cases.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
1+
from abc import ABC, abstractmethod
2+
13
from sponsors import notifications
24
from sponsors.models import Sponsorship, Contract, SponsorContact, SponsorEmailNotificationTemplate
35
from sponsors.pdf import render_contract_to_pdf_file, render_contract_to_docx_file
46

57

6-
class BaseUseCaseWithNotifications:
8+
class BaseUseCaseWithNotifications(ABC):
79
notifications = []
810

11+
@classmethod
12+
def build(cls):
13+
return cls(cls.notifications)
14+
15+
@abstractmethod
16+
def execute(self, *args, **kwargs):
17+
pass
18+
919
def __init__(self, notifications):
1020
self.notifications = notifications
1121

1222
def notify(self, **kwargs):
1323
for notification in self.notifications:
1424
notification.notify(**kwargs)
1525

16-
@classmethod
17-
def build(cls):
18-
return cls(cls.notifications)
19-
2026

2127
class CreateSponsorshipApplicationUseCase(BaseUseCaseWithNotifications):
2228
notifications = [

0 commit comments

Comments
 (0)