diff --git a/python-naive/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__project_slug }}.py b/python-naive/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__project_slug }}.py index 2e11309..1079a03 100644 --- a/python-naive/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__project_slug }}.py +++ b/python-naive/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__project_slug }}.py @@ -29,7 +29,9 @@ class CONST(object): # Values you don't have to set, these are their internal defaults. You may optionally add a key 'is_global' equal # to either True or False. By default if left off it'll be assumed False. Script will treat values where # 'is_global' equals True as not being overridable in a '[section]'. It's a setting that only makes sense in a - # global context for the entire script. + # global context for the entire script. An option where 'empty_ok' equals True can safely be unset or set to + # an empty string. An example config.ini file may give a sane config example value here, removing that value + # still results in a valid file. CFG_KNOWN_DEFAULTS = [ {"key": "self_name", "value": "{{ cookiecutter.__project_slug }}"}, {"key": "tmp_base_dir", "value": os.path.join(CFG_THIS_FILE_DIRNAME, "data/tmp/%(self_name)s")}, @@ -41,8 +43,13 @@ class CONST(object): {"key": "{{ cookiecutter.__project_slug_under }}_some_option", "value": "http://localhost:8000/api/query", "is_global": True}, {"key": "another_option", "value": "first", "is_global": True} ] - # In all sections other than 'default' the following settings are known and accepted. We silently ignore other - # settings. We use 'is_mandatory' to determine if we have to raise errors on missing settings. + # In all sections other than 'default' the following settings are known and accepted. We ignore other settings. + # Per CFG_KNOWN_DEFAULTS above most '[DEFAULT]' options are accepted by virtue of being defaults and overridable. + # The only exception are options where "is_global" equals True, they can't be overridden in '[sections]'; any + # attempt at doing it anyway will be ignored. The main purpose of this list is to name settings that do not have + # a default value but can - if set - influence how a '[section]' behaves. Repeating a '[DEFAULT]' here does not + # make sense. We use 'is_mandatory' to determine if we have to raise errors on missing settings. Here + # 'is_mandatory' means the setting must be given in a '[section]'. It may be empty. CFG_KNOWN_SECTION = [ {"key": "min_duration", "is_mandatory": False}, {"key": "max_duration", "is_mandatory": False},