Skip to content

Commit e494184

Browse files
committed
handling Auth HTML emails, thanks Hadi
1 parent 39534a3 commit e494184

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ format: uv
3636
uv tool run ruff format
3737

3838
test: uv
39-
uv run --extra test pytest --cov=py4web --cov-report html:cov.html -v tests/
39+
uv run --python 3.13 --extra test pytest --cov=py4web --cov-report html:cov.html -v tests/
4040

4141
setup: uv
4242
uv run py4web.py setup apps

py4web/utils/auth.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,12 @@ def send(self, name, user, **attrs):
993993
d.update(**attrs)
994994
email = user["email"]
995995
subject = message["subject"].format(**d)
996-
body = message["body"].format(**d)
996+
if isinstance(message["body"], (list, tuple)):
997+
# the body is (TEXT, HTML)
998+
body = [element.format(**d) for element in message["body"]]
999+
else:
1000+
# the body is TEXT
1001+
body = message["body"].format(**d)
9971002
if not self.sender:
9981003
print('Mock send to %s subject "%s" body:\n%s\n' % (email, subject, body))
9991004
return True

0 commit comments

Comments
 (0)