Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Ship the email templates as package_data #4052

Merged
merged 2 commits into from
Oct 17, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Put the warning blob at the top of the file
  • Loading branch information
richvdh committed Oct 17, 2018
commit c8f2c199910b70a5d94acf5597a4f3ba94cd3969
15 changes: 9 additions & 6 deletions synapse/config/emailconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@

logger = logging.getLogger(__name__)

TEMPLATE_DIR_WARNING = """\
WARNING: The email notifier is configured to look for templates in '%(template_dir)s',
but no templates could be found there. We will fall back to using the example templates;
to get rid of this warning, leave 'email.template_dir' unset.
"""


class EmailConfig(Config):
def read_config(self, config):
Expand Down Expand Up @@ -81,12 +87,9 @@ def read_config(self, config):
os.path.join(self.email_template_dir, self.email_notif_template_text)
)
):
t = """\
WARNING: The email notifier is configured to look for templates in '%s', but no templates
could be found there. We will fall back to using the example templates; to get rid of this
warning, leave 'email.template_dir' unset.
""" % (self.email_template_dir,)

t = TEMPLATE_DIR_WARNING % {
"template_dir": self.email_template_dir,
}
print(textwrap.fill(t, width=80) + "\n", file=sys.stderr)
self.email_template_dir = None

Expand Down