mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-29 17:08:31 -04:00
Rewrite cache decorator to reference args by name
`@cache.delete('user', 'user_id')` is easier to read and understand than
`@cache.delete('user', key_from_args=[1])`. This will become even more
apparent if we have to start doing stuff like `key_from_args=[1, 5]`,
which is a lot more opaque than just saying
`'service_id', 'template_id'`.
It does make the implementation a bit more complex, but I’m not too
worried about that because:
- the tests are solid
- it’s nicely encapsulated
This commit is contained in:
@@ -27,7 +27,7 @@ class OrganisationsClient(NotifyAdminAPIClient):
|
||||
def get_service_organisation(self, service_id):
|
||||
return self.get(url="/service/{}/organisation".format(service_id))
|
||||
|
||||
@cache.delete('service')
|
||||
@cache.delete('service', 'service_id')
|
||||
def update_service_organisation(self, service_id, org_id):
|
||||
data = {
|
||||
'service_id': service_id
|
||||
|
||||
Reference in New Issue
Block a user