mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Don’t allow use of .get() on service model
Making people use a property is a sure way to make sure they’re spelling the name of the property correctly, and allows us to easily swap out properties that call through to the underlying JSON, and properties which are implemented as methods. The API should always return something in the JSON for a property, even if it’s just `None`.
This commit is contained in:
@@ -53,10 +53,9 @@ class Service():
|
||||
)
|
||||
|
||||
def get(self, attr, default=None):
|
||||
try:
|
||||
return self._dict[attr]
|
||||
except KeyError:
|
||||
return default
|
||||
raise NotImplementedError(
|
||||
'Use current_service.{} instead of current_service.get(\'{}\')'.format(attr, attr)
|
||||
)
|
||||
|
||||
@property
|
||||
def trial_mode(self):
|
||||
|
||||
Reference in New Issue
Block a user