-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3583 from open-formulieren/issue/backport-yubin-r…
…ace-patch Backport yubin patch
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Patches | ||
|
||
This directory contains patches for third party code that has not been or won't ever be applied, but | ||
are required for Open Forms to properly function. They are included in the docker image through the | ||
`Dockerfile` instructions. | ||
|
||
## Django-yubin | ||
|
||
The Yubin patches are for the following PR: | ||
|
||
- https://github.com/APSL/django-yubin/pull/73 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
set -eu -o pipefail | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
sitepackagesdir=${1:-} | ||
if [[ -z "$sitepackagesdir" ]]; then | ||
echo "You must provide the path to site-packages"; | ||
exit 1; | ||
fi | ||
|
||
cd $sitepackagesdir | ||
echo "Patching packages in: $(pwd)" | ||
|
||
for patch_file in $SCRIPT_DIR/yubin_00{1..1}.patch | ||
do | ||
echo "Applying patch file: $patch_file" | ||
git apply $patch_file | ||
done | ||
|
||
echo "Done patching." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
From 90ed636b1b1c7d3028c428e9e48a85683e619903 Mon Sep 17 00:00:00 2001 | ||
From: Viicos <65306057+Viicos@users.noreply.github.com> | ||
Date: Wed, 8 Nov 2023 11:30:38 +0100 | ||
Subject: [PATCH] Call Celery task with `transaction.on_commit` | ||
|
||
--- | ||
django_yubin/models.py | 5 +++-- | ||
1 file changed, 3 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/django_yubin/models.py b/django_yubin/models.py | ||
index 7a1e9db..352c5e3 100644 | ||
--- a/django_yubin/models.py | ||
+++ b/django_yubin/models.py | ||
@@ -4,6 +4,7 @@ | ||
from email import policy | ||
from email import encoders as Encoders | ||
from email.mime.base import MIMEBase | ||
+from functools import partial | ||
|
||
from django.core.exceptions import FieldError | ||
from django.core.mail.message import ( | ||
@@ -11,7 +12,7 @@ | ||
EmailMessage, | ||
EmailMultiAlternatives, | ||
) | ||
-from django.db import models | ||
+from django.db import models, transaction | ||
from django.db.models import F | ||
from django.utils.module_loading import import_string | ||
from django.utils.text import Truncator | ||
@@ -254,7 +255,7 @@ def enqueue(self, log_message=None): | ||
self.mark_as(self.STATUS_QUEUED, log_message) | ||
|
||
try: | ||
- tasks.send_email.delay(self.pk) | ||
+ transaction.on_commit(partial(tasks.send_email.delay, message_pk=self.pk)) | ||
return True | ||
except Exception as e: | ||
self.date_enqueued = backup['date_enqueued'] |