From 31230de014db16f8e7f4963bbe39fb89d7cca6f2 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 16 Mar 2023 16:33:17 +0000 Subject: [PATCH] Move magic string and add a comment explaining its role --- hooks/pre_gen_project.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 61176630c..4f4378f58 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -17,6 +17,14 @@ INFO = "\x1b[1;33m [INFO]: " HINT = "\x1b[3;33m" SUCCESS = "\x1b[1;32m [SUCCESS]: " +# The content of this string is evaluated by Jinja, and plays an important role. +# It updates the cookiecutter context to trim leading and trailing spaces +# from domain/email values +""" +{{ cookiecutter.update({ "domain_name": cookiecutter.domain_name | trim }) }} +{{ cookiecutter.update({ "email": cookiecutter.email | trim }) }} +""" + project_slug = "{{ cookiecutter.project_slug }}" if hasattr(project_slug, "isidentifier"): assert ( @@ -80,8 +88,3 @@ if ( "Mail Service for sending emails." ) sys.exit(1) - -""" -{{ cookiecutter.update({ "domain_name": cookiecutter.domain_name | trim }) }} -{{ cookiecutter.update({ "email": cookiecutter.email | trim }) }} -"""