From b0d5123bc509cab893607c83460d78651077c0bf Mon Sep 17 00:00:00 2001 From: Victoria Earl Date: Thu, 16 May 2024 13:09:05 -0400 Subject: [PATCH] Also fix template URLs for plugins The email template path is actually different in the main plugin vs the root repo, so we need to account for that difference when building links to GitHub. --- uber/automated_emails.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/uber/automated_emails.py b/uber/automated_emails.py index 457411fd9..ecc000609 100644 --- a/uber/automated_emails.py +++ b/uber/automated_emails.py @@ -133,9 +133,12 @@ def update_template_plugin_info(self): env = JinjaEnv.env() try: template_path = pathlib.Path(env.get_or_select_template(os.path.join('emails', self.template)).filename) - self.template_plugin_name = template_path.parts[2] + path_offset = 0 + if template_path.parts[2] == 'plugins': + path_offset = 2 + self.template_plugin_name = template_path.parts[2 + path_offset] self.template_url = (f"https://github.com/magfest/{self.template_plugin_name}/tree/main/" - f"{self.template_plugin_name}/{pathlib.Path(*template_path.parts[3:]).as_posix()}") + f"{self.template_plugin_name}/{pathlib.Path(*template_path.parts[(3 + path_offset):]).as_posix()}") except jinja2.exceptions.TemplateNotFound: self.template_plugin_name = "ERROR: TEMPLATE NOT FOUND" self.template_url = ""