mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 04:23:46 +00:00
send_custom_email: Use a special .gitignored directory.
Previously, the send_custom_email code path leaked files in paths that were not `.gitignored`, under templates/zerver/emails. This became problematic when we added automated tests for this code path, as it meant we leaked these files every time `test-backend` ran. Fix this by ensuring all the files we generate are in this special subdirectory.
This commit is contained in:
@@ -29,12 +29,12 @@ def configure_cssutils() -> None:
|
||||
configure_cssutils()
|
||||
|
||||
def inline_template(template_source_name: str) -> None:
|
||||
os.makedirs(COMPILED_EMAIL_TEMPLATES_PATH, exist_ok=True)
|
||||
|
||||
template_name = template_source_name.split('.source.html')[0]
|
||||
compiled_template_path = os.path.join(COMPILED_EMAIL_TEMPLATES_PATH,
|
||||
template_name + ".html")
|
||||
template_path = os.path.join(EMAIL_TEMPLATES_PATH, template_source_name)
|
||||
compiled_template_path = os.path.join(os.path.dirname(template_path), "compiled",
|
||||
os.path.basename(template_name) + ".html")
|
||||
|
||||
os.makedirs(os.path.dirname(compiled_template_path), exist_ok=True)
|
||||
|
||||
with open(template_path) as template_source_file:
|
||||
template_str = template_source_file.read()
|
||||
|
||||
Reference in New Issue
Block a user