mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Raise exception when overriding a custom property
If a subclass of `JSONModel` defines a property then we shouldn’t try to override it with the value from the underlying dictionary. Rather than silently fail we should raise an exception because it will help keep our list of `ALLOWED_PROPERTIES` nice and tidy.
This commit is contained in:
@@ -13,7 +13,7 @@ class JSONModel(SerialisedModel):
|
||||
# in the case of a bad request _dict may be `None`
|
||||
self._dict = _dict or {}
|
||||
for property in self.ALLOWED_PROPERTIES:
|
||||
if property in self._dict and not hasattr(self, property):
|
||||
if property in self._dict:
|
||||
setattr(self, property, self._dict[property])
|
||||
|
||||
def __bool__(self):
|
||||
|
||||
Reference in New Issue
Block a user