mirror of
https://github.com/simple-login/app.git
synced 2024-11-13 07:31:12 +01:00
Fix signature
This commit is contained in:
parent
4a533bb03b
commit
d53ea381a0
1 changed files with 6 additions and 1 deletions
|
@ -4,6 +4,7 @@ import os
|
|||
import random
|
||||
import string
|
||||
from email.message import EmailMessage
|
||||
from typing import Optional, Dict
|
||||
|
||||
import jinja2
|
||||
from flask import url_for
|
||||
|
@ -64,11 +65,15 @@ def pretty(d):
|
|||
print(json.dumps(d, indent=2))
|
||||
|
||||
|
||||
def load_eml_file(filename: str, template_values={}) -> EmailMessage:
|
||||
def load_eml_file(
|
||||
filename: str, template_values: Optional[Dict[str, str]] = None
|
||||
) -> EmailMessage:
|
||||
emails_dir = os.path.join(
|
||||
os.path.dirname(os.path.realpath(__file__)), "example_emls"
|
||||
)
|
||||
fullpath = os.path.join(emails_dir, filename)
|
||||
template = jinja2.Template(open(fullpath).read())
|
||||
if not template_values:
|
||||
template_values = {}
|
||||
rendered = template.render(**template_values)
|
||||
return email.message_from_string(rendered)
|
||||
|
|
Loading…
Reference in a new issue