mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 02:23:19 -04:00
We wrote custom `__getattr__` and `__getitem__` implementation to make it easier to find code that was accessing fields in the dictionary that we weren’t aware of. See this commit for details: https://github.com/alphagov/notifications-admin/commit/b48305c50d0d6b1674a39e0fd5a3c4768d281a66 Now that no view-layer code accesses the service dictionary directly we don’t need to support this behaviour any more. By removing it we can make the model code simpler, and closer to the `SerialisedModel` it inherits from. It still needs some custom implementation because: - a lot of our test fixtures are lazy and don’t set up all the expected fields, so we need to account for fields sometimes being present in the underlying dictionary and sometimes not - we often implement a property that has the same name as one of the fields in the JSON, so we have to be careful not to try to override this property with the value from the underlying JSON