31 lines
1,017 B
Django/Jinja
31 lines
1,017 B
Django/Jinja
from enum import Enum
|
|
|
|
|
|
class NotificationType(str, Enum):
|
|
"""Enumerate notification types."""
|
|
{% for provider in notification_providers %}
|
|
{{ provider.upper().replace(".", "_") }} = "{{ provider }}"
|
|
"""{{ notification_providers[provider]["title"] }}"""
|
|
{% endfor %}
|
|
|
|
notification_provider_options = {
|
|
{%- for provider in notification_providers %}
|
|
NotificationType.{{ provider.upper().replace(".", "_") }}: dict(
|
|
{%- for input_name in notification_providers[provider]["inputs"] %}
|
|
{%- set input = notification_providers[provider]["inputs"][input_name] %}
|
|
{{ input_name }}=dict(type="{{ input["type"] }}", required={{ input["required"] }}),
|
|
{%- endfor %}
|
|
),
|
|
{%- endfor %}
|
|
}
|
|
|
|
notification_provider_conditions = dict(
|
|
{%- for provider in notification_provider_conditions %}
|
|
{{ provider }}=dict(
|
|
{%- for key, value in notification_provider_conditions[provider].items() %}
|
|
{{ key }}={{ value }},
|
|
{%- endfor %}
|
|
),
|
|
{%- endfor %}
|
|
)
|
|
|