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

3232 if removed:
3333 raise RuntimeError(f"These settings are no longer used: {removed}.")
3434
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+
3539 def __getattr__(self, attr: str) -> Any:
3640 if attr not in self.defaults:
3741 raise AttributeError(f"Invalid Setting: '{attr}'")

The check that tells the two apart

failpass·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.