From d75a61b4e8563299cd43a36c358953605bfa6746 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 13 Mar 2023 19:13:52 +0100 Subject: [PATCH] Email: fix handling templates_path default value --- mylib/email.py | 1 + mylib/scripts/email_test_with_config.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mylib/email.py b/mylib/email.py index e90f1d7..9370de2 100644 --- a/mylib/email.py +++ b/mylib/email.py @@ -143,6 +143,7 @@ class EmailClient( section.add_option( StringOption, "templates_path", + default=self._defaults["templates_path"], comment="Path to templates directory", ) diff --git a/mylib/scripts/email_test_with_config.py b/mylib/scripts/email_test_with_config.py index b20b336..2533eac 100644 --- a/mylib/scripts/email_test_with_config.py +++ b/mylib/scripts/email_test_with_config.py @@ -18,12 +18,11 @@ def main(argv=None): # pylint: disable=too-many-locals,too-many-statements config = Config(__doc__, __name__.replace(".", "_")) email_client = EmailClient(config=config) - email_client.configure() - config.set_default( - "email", + email_client.set_default( "templates_path", os.path.join(os.path.dirname(os.path.realpath(__file__)), "email_templates"), ) + email_client.configure() # Options parser parser = config.get_arguments_parser(description=__doc__)