Skip to content

[BUG] Boolean configuration parameters can't explicitly be set to False #736

@cmro

Description

@cmro

Tag/version of Container Images
maxking/mailman-web:0.5.*

Boolean configuration parameters such as EMAIL_USE_TLS and EMAIL_USE_SSL cannot be explicitly set to False.
Since the values are read from environment variables (SMTP_USE_TLS and SMTP_USE_SSL) in settings.py, they are always of type string.

EMAIL_USE_TLS = os.environ.get('SMTP_USE_TLS', False)

This causes the parameters to be ineffective because the expression if EMAIL_USE_TLS always evaluates to True as soon as a value is assigned, even if it is the string “False”. The text is irrelevant.
This means that TLS encryption is attempted even if the parameter is set to False in your environment, which is somewhat confusing.
The problem does not occur if the configuration parameters are not set, because then the default value applies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions