Skip to content

Commit

Permalink
Fix late lambda binding bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Apr 19, 2024
1 parent 6a05bf1 commit 13a00f5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/openforms/forms/tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import copy
import logging
from datetime import timedelta
from functools import partial

from django.db import DatabaseError, transaction
from django.db.utils import IntegrityError
Expand Down Expand Up @@ -160,7 +161,7 @@ def activate_forms():
extra={"pk": form.pk},
)
else:
transaction.on_commit(lambda: logevent.form_activated(form))
transaction.on_commit(partial(logevent.form_activated, form))


@app.task()
Expand All @@ -186,4 +187,4 @@ def deactivate_forms():
)

else:
transaction.on_commit(lambda: logevent.form_deactivated(form))
transaction.on_commit(partial(logevent.form_activated, form))
14 changes: 10 additions & 4 deletions src/openforms/registrations/contrib/stuf_zds/plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import re
from dataclasses import dataclass
from functools import partial

from django.urls import reverse
from django.utils.translation import gettext_lazy as _
Expand Down Expand Up @@ -283,7 +284,7 @@ def items(self):
zaak_data.update({"betalings_indicatie": payment_status})

execute_unless_result_exists(
lambda: client.create_zaak(zaak_id, zaak_data, LangInjection()),
partial(client.create_zaak, zaak_id, zaak_data, LangInjection()),
submission,
"intermediate.zaak_created",
default=False,
Expand All @@ -298,7 +299,9 @@ def items(self):
)
submission_report = SubmissionReport.objects.get(submission=submission)
execute_unless_result_exists(
lambda: client.create_zaak_document(zaak_id, doc_id, submission_report),
partial(
client.create_zaak_document, zaak_id, doc_id, submission_report
),
submission,
"intermediate.documents_created.pdf-report",
default=False,
Expand All @@ -313,8 +316,11 @@ def items(self):
default="",
)
execute_unless_result_exists(
lambda: client.create_zaak_attachment(
zaak_id, attachment_doc_id, attachment
partial(
client.create_zaak_attachment,
zaak_id,
attachment_doc_id,
attachment,
),
submission,
f"intermediate.documents_created.{attachment.id}",
Expand Down

0 comments on commit 13a00f5

Please sign in to comment.