Mercurial > p > roundup > code
comparison roundup/configuration.py @ 7251:ab0ea9f03866
fix initialization of option_validator
When using option_validator to validate config.ini entries for
detectors or extensions, the list of validators was not reset when the
tracker was re-opened.
This led to the second command run in roundup-admin crashing when the
main config.ini file was read. On second tracker open/read
option_validator lists an extension/detector option that doesn't exist
in the main config.ini. When it tried to validate, the missing option
caused a crash.
This only happens if a validator is added in an extension/detector.
If the only validators ae ones for the main config.ini everything
works fine across multiple tracker opens.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 12 Apr 2023 11:20:14 -0400 |
| parents | 5c71b27aa68e |
| children | a210f4437b49 |
comparison
equal
deleted
inserted
replaced
| 7250:ee972b3073cb | 7251:ab0ea9f03866 |
|---|---|
| 1754 # actual name of the config file. set on load. | 1754 # actual name of the config file. set on load. |
| 1755 filepath = os.path.join(HOME, INI_FILE) | 1755 filepath = os.path.join(HOME, INI_FILE) |
| 1756 | 1756 |
| 1757 # List of option names that need additional validation after | 1757 # List of option names that need additional validation after |
| 1758 # all options are loaded. | 1758 # all options are loaded. |
| 1759 option_validators = [] | 1759 option_validators = None |
| 1760 | 1760 |
| 1761 def __init__(self, config_path=None, layout=None, settings=None): | 1761 def __init__(self, config_path=None, layout=None, settings=None): |
| 1762 """Initialize confing instance | 1762 """Initialize confing instance |
| 1763 | 1763 |
| 1764 Parameters: | 1764 Parameters: |
| 1780 # initialize option containers: | 1780 # initialize option containers: |
| 1781 self.sections = [] | 1781 self.sections = [] |
| 1782 self.section_descriptions = {} | 1782 self.section_descriptions = {} |
| 1783 self.section_options = {} | 1783 self.section_options = {} |
| 1784 self.options = {} | 1784 self.options = {} |
| 1785 self.option_validators = [] | |
| 1785 # add options from the layout structure | 1786 # add options from the layout structure |
| 1786 if layout: | 1787 if layout: |
| 1787 for section in layout: | 1788 for section in layout: |
| 1788 self.add_section(*section) | 1789 self.add_section(*section) |
| 1789 if config_path is not None: | 1790 if config_path is not None: |
