One function
SettingsHolder in MrThearMan/django-settings-holder
The author described this change as “Raise an error about undefined user settings”. It counts as a record because the check below fails on the code as it stood at cbffa3f9c and passes on 3bf55cb82, with nothing else changed between the two runs.
Fix saved2022-03-05
Sharing licenceMIT · LICENSE
Change size+4 −0
What the code was meant to do, written into the code itself as a docstring
Object that allows settings to be accessed with attributes. Any setting with string import paths will be automatically resolved.
The change
| 32 | 32 | if removed: | |
| 33 | 33 | raise RuntimeError(f"These settings are no longer used: {removed}.") | |
| 34 | 34 | ||
| 35 | + | undefined = set(self.user_settings).difference(set(self.defaults)) | |
| 36 | + | if undefined: | |
| 37 | + | raise RuntimeError(f"These settings are not defined (no defaults): {undefined}.") | |
| 38 | + | ||
| 35 | 39 | def __getattr__(self, attr: str) -> Any: | |
| 36 | 40 | if attr not in self.defaults: | |
| 37 | 41 | raise AttributeError(f"Invalid Setting: '{attr}'") |
The check that tells the two apart
fail→pass·tests/test_utils.py::test_settings_holder__using_undefined_setting
Check file tests/test_utils.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itcbffa3f9cfc9a0250d6d91da7b22c9009072b9ef
Broken version dated2022-01-22
Modulesettings_holder.holder
Units changedSettingsHolder
Fingerprint8f168e067fb182b2
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.