mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Rename template.py >> templates.py
This commit is contained in:
@@ -24,7 +24,7 @@ from galaxy import (
|
||||
schema,
|
||||
util,
|
||||
)
|
||||
from galaxy.config import template
|
||||
from galaxy.config import templates
|
||||
from galaxy.managers import (
|
||||
base,
|
||||
deletable,
|
||||
@@ -495,8 +495,8 @@ class UserManager(base.ModelManager, deletable.PurgableManagerMixin):
|
||||
"custom_message": self.app.config.custom_activation_email_message,
|
||||
"expiry_days": self.app.config.activation_grace_period,
|
||||
}
|
||||
body = template.render(TXT_ACTIVATION_EMAIL_TEMPLATE_RELPATH, template_context, self.app.config.templates_dir)
|
||||
html = template.render(HTML_ACTIVATION_EMAIL_TEMPLATE_RELPATH, template_context, self.app.config.templates_dir)
|
||||
body = templates.render(TXT_ACTIVATION_EMAIL_TEMPLATE_RELPATH, template_context, self.app.config.templates_dir)
|
||||
html = templates.render(HTML_ACTIVATION_EMAIL_TEMPLATE_RELPATH, template_context, self.app.config.templates_dir)
|
||||
to = email
|
||||
frm = self.app.config.email_from or f"galaxy-no-reply@{host}"
|
||||
subject = "Galaxy Account Activation"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Test custom template configuration and rendering."""
|
||||
|
||||
from galaxy.config import template
|
||||
from galaxy.config import templates
|
||||
|
||||
TEMPLATE_RELPATH = "mail/activation-email.html"
|
||||
CONTEXT = {"name": "Jane Doe"}
|
||||
@@ -20,7 +20,7 @@ CUSTOM_TEMPLATE_OUTPUT = "This is my custom template!\n" f"Name: {CONTEXT['name'
|
||||
def test_it_can_render_a_default_template(tmp_path):
|
||||
"""It should fall back on codebase default."""
|
||||
custom_templates_dir = tmp_path
|
||||
output = template.render(
|
||||
output = templates.render(
|
||||
TEMPLATE_RELPATH,
|
||||
CONTEXT,
|
||||
custom_templates_dir,
|
||||
@@ -39,7 +39,7 @@ def test_it_can_render_a_custom_template(tmp_path):
|
||||
with open(template_path, "w") as f:
|
||||
f.write(CUSTOM_TEMPLATE)
|
||||
# It should find the custom template
|
||||
output = template.render(
|
||||
output = templates.render(
|
||||
TEMPLATE_RELPATH,
|
||||
CONTEXT,
|
||||
custom_templates_dir,
|
||||
|
||||
Reference in New Issue
Block a user