|
24 | 24 | from mailing_list.models import UserMailingListSubscription |
25 | 25 |
|
26 | 26 | logger = logging.getLogger(__name__) |
27 | | -_mailman = MailmanClient() |
28 | 27 |
|
29 | 28 | _CONFIRM_SALT = "mailing-list-confirm-a40b24dc-a26d-49ca-81d1-5b2fccb5fd7b" |
30 | 29 | _CONFIRM_MAX_AGE = 7 * 24 * 60 * 60 # 7 days in seconds |
@@ -182,7 +181,7 @@ def post(self, request): |
182 | 181 | unsubscribed.append(list_id) |
183 | 182 | continue |
184 | 183 | try: |
185 | | - _mailman.unsubscribe(email, list_id) |
| 184 | + MailmanClient().unsubscribe(email, list_id) |
186 | 185 | UserMailingListSubscription.objects.filter( |
187 | 186 | user=request.user, list_id=list_id |
188 | 187 | ).delete() |
@@ -372,7 +371,7 @@ def _handle_authenticated(self, request, email, list_id, managed_lists): |
372 | 371 |
|
373 | 372 | def _handle_anonymous(self, request, email, list_id): |
374 | 373 | try: |
375 | | - if _mailman.is_confirmed(email, list_id): |
| 374 | + if MailmanClient().is_confirmed(email, list_id): |
376 | 375 | if _is_htmx(request): |
377 | 376 | return self._card( |
378 | 377 | request, |
@@ -456,7 +455,7 @@ def get(self, request, token): |
456 | 455 |
|
457 | 456 | for list_id in list_ids: |
458 | 457 | try: |
459 | | - _mailman.subscribe(email, list_id) |
| 458 | + MailmanClient().subscribe(email, list_id) |
460 | 459 | if user is not None: |
461 | 460 | UserMailingListSubscription.objects.filter( |
462 | 461 | user=user, list_id=list_id |
|
0 commit comments