Skip to content

Commit

Permalink
notifications: fix bug when templates are given as parameter
Browse files Browse the repository at this point in the history
due to a variable name clash, the loop over all templates, has set the
fallback_template to a string, causing a type error
  • Loading branch information
wagner-intevation committed Jul 3, 2023
1 parent 6e528c8 commit 5b2d123
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
intelmq-mailgen (1.3.4-1) stable; urgency=medium

* notifications: fix bug when templates are given as parameter
due to a variable name clash, the loop over all templates, has set the
fallback_template to a string, causing a type error

-- Sebastian Wagner <[email protected]> Fri, 30 Jun 2023 17:11:41 +0200

intelmq-mailgen (1.3.3-1) stable; urgency=medium

* Allow passing templates as parameters
Expand Down
6 changes: 3 additions & 3 deletions intelmqmail/cb.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ def mailgen(config: dict, scripts: list, process_all: bool = False, template: Op
if templates:
for template_name in templates:
# convert string template to Template object
template = templates[template_name].strip()
subject = template[:template.find('\n')] # first line
body = template[template.find('\n') + 1:] + '\n' # rest plus trailing newline
template_strip = templates[template_name].strip()
subject = template_strip[:template_strip.find('\n')] # first line
body = template_strip[template_strip.find('\n') + 1:] + '\n' # rest plus trailing newline
templates[template_name] = Template.from_strings(subject, body)

try:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='1.3.3',
version='1.3.4',

description='A mail sending module for IntelMQ',

Expand Down

0 comments on commit 5b2d123

Please sign in to comment.