mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 19:03:30 -05:00
`__getattr__` is called whenever an attribute error is raised. This means that if something deep inside a property on a model raised an attribute error, that error would be caught by `__getattr__`, which would then raise an exception that looked like the property itself didn’t exist. Very confusing. The solution seems to be to override `__getattribute__` instead, which handles _all_ attributes, not just those that aren’t explicitly defined. We then only intervene if the desired attribute is one of the `ALLOWED_PROPERTIES`, otherwise falling through to the built in methods of the underlying `object`.