first version able to send

This commit is contained in:
2026-06-11 00:06:44 +02:00
parent ce43f2658f
commit 3b06f3670e
12 changed files with 740 additions and 67 deletions

View File

@@ -273,6 +273,8 @@ def _attachment_summaries(resolution: EntryAttachmentResolution) -> list[Message
required=attachment.required,
allow_multiple=attachment.allow_multiple,
zip_enabled=attachment.zip_enabled,
base_path_name=attachment.base_path_name,
base_path=attachment.base_path,
file_filter=attachment.file_filter,
directory=attachment.directory,
matches=attachment.matches,
@@ -330,9 +332,8 @@ def _iter_attachment_configs_for_resolution(config: CampaignConfig, entry: Entry
if entry.combine_attachments:
for index, attachment_config in enumerate(config.attachments.global_):
yield "global", index, attachment_config
if config.attachments.allow_individual:
for index, attachment_config in enumerate(entry.attachments):
yield "entry", index, attachment_config
for index, attachment_config in enumerate(entry.attachments):
yield "entry", index, attachment_config
def _zip_config_for_attachment(config: CampaignConfig, entry: EntryConfig, resolved: ResolvedAttachment):
@@ -457,9 +458,10 @@ def build_entry_message(
subject_template, text_template, html_template = _load_template_parts(config, campaign_file)
values = _template_values(config, entry)
subject = _render_template(subject_template, values)
text_body = _render_template(text_template or "", values) if text_template is not None else None
html_body = _render_template(html_template or "", values) if html_template is not None else None
keep_missing_placeholders = not config.validation_policy.ignore_empty_fields
subject = _render_template(subject_template, values, keep_missing=keep_missing_placeholders)
text_body = _render_template(text_template or "", values, keep_missing=keep_missing_placeholders) if text_template is not None else None
html_body = _render_template(html_template or "", values, keep_missing=keep_missing_placeholders) if html_template is not None else None
unresolved = sorted(
_find_unresolved_placeholders(subject)

View File

@@ -52,6 +52,8 @@ class MessageAttachmentSummary(BaseModel):
required: bool
allow_multiple: bool
zip_enabled: bool
base_path_name: str | None = None
base_path: str | None = None
file_filter: str
directory: str
matches: list[str] = Field(default_factory=list)