-
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.
[#4821] Fixed email digest for BRK and addressNL component
We want the email digest to report problems (broken configuration) for the addressNL component only when a valid BRK service and the validator are defined/configured. Backport-of: #4952
- Loading branch information
Showing
6 changed files
with
179 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
from glom import glom | ||
|
||
from openforms.forms.models.form import Form | ||
from openforms.plugins.exceptions import InvalidPluginConfiguration | ||
|
||
from .checks import BRKValidatorCheck | ||
from .models import BRKConfig | ||
from .validators import BRK_ZAKELIJK_GERECHTIGD_VALIDATOR_ID | ||
|
||
|
||
def check_brk_config_for_addressNL() -> str: | ||
live_forms = Form.objects.live() | ||
|
||
if any(form.has_component("addressNL") for form in live_forms): | ||
try: | ||
BRKValidatorCheck.check_config() | ||
except InvalidPluginConfiguration as e: | ||
return e.args[0] | ||
for form in live_forms: | ||
components = form.iter_components() | ||
for component in components: | ||
if ( | ||
component["type"] == "addressNL" | ||
and (plugins := glom(component, "validate.plugins", default=[])) | ||
and BRK_ZAKELIJK_GERECHTIGD_VALIDATOR_ID in plugins | ||
and BRKConfig.get_solo().service | ||
): | ||
try: | ||
BRKValidatorCheck.check_config() | ||
except InvalidPluginConfiguration as e: | ||
return e.args[0] | ||
|
||
return "" |
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
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
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