diff options
Diffstat (limited to 'accounts/backend/mail/__init__.py')
-rw-r--r-- | accounts/backend/mail/__init__.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/accounts/backend/mail/__init__.py b/accounts/backend/mail/__init__.py index ecd0d45..f2ec5d5 100644 --- a/accounts/backend/mail/__init__.py +++ b/accounts/backend/mail/__init__.py @@ -1,18 +1,25 @@ # -*- coding: utf-8 -*- -class Backend(object): +from flask.app import Flask +from jinja2 import Template +from jinja2.environment import TemplateModule - def __init__(self, app): + +class Backend(): + app: Flask + + def __init__(self, app: Flask) -> None: self.app = app - def _send(self, recipient, content): + def _send(self, recipient: str, content: TemplateModule): raise NotImplementedError() - def send(self, recipient, template, **kwargs): + def send(self, recipient: str, template, **kwargs): if recipient is None: return - tmpl = self.app.jinja_env.get_or_select_template(template) + tmpl: Template = \ + self.app.jinja_env.get_or_select_template(template) kwargs['recipient'] = recipient module = tmpl.make_module(kwargs) |