From e0145fad506eed4789688b570bc2fc8e00b327c9 Mon Sep 17 00:00:00 2001 From: John Davis Date: Mon, 21 Nov 2022 16:39:19 -0500 Subject: [PATCH] Rename template.py >> templates.py --- lib/galaxy/config/{template.py => templates.py} | 0 lib/galaxy/managers/users.py | 6 +++--- test/unit/app/test_custom_templates.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) rename lib/galaxy/config/{template.py => templates.py} (100%) diff --git a/lib/galaxy/config/template.py b/lib/galaxy/config/templates.py similarity index 100% rename from lib/galaxy/config/template.py rename to lib/galaxy/config/templates.py diff --git a/lib/galaxy/managers/users.py b/lib/galaxy/managers/users.py index 4b644f742c5..f29aac5f002 100644 --- a/lib/galaxy/managers/users.py +++ b/lib/galaxy/managers/users.py @@ -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" diff --git a/test/unit/app/test_custom_templates.py b/test/unit/app/test_custom_templates.py index d22dcf4eb3c..e3a2f20136d 100644 --- a/test/unit/app/test_custom_templates.py +++ b/test/unit/app/test_custom_templates.py @@ -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,