mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-14 09:03:33 -05:00
Rewrite cache decorator to use format string
This is easier to read than having to understand the arguments 1…n of
the cache decorator are ‘magic’, and gives us more flexibility about
how the cache keys are formatted, eg being able to add words in the
middle of them.
Also changes the key format for all templates to be
`service-{service_id}-templates` instead of `templates-{service_id}`
because then it’s clearer what the ID represents.
This commit is contained in:
@@ -44,8 +44,8 @@ class InviteApiClient(NotifyAdminAPIClient):
|
||||
self.post(url='/service/{0}/invite/{1}'.format(service_id, invited_user_id),
|
||||
data=data)
|
||||
|
||||
@cache.delete('service', 'service_id')
|
||||
@cache.delete('user', 'invited_user_id')
|
||||
@cache.delete('service-{service_id}')
|
||||
@cache.delete('user-{invited_user_id}')
|
||||
def accept_invite(self, service_id, invited_user_id):
|
||||
data = {'status': 'accepted'}
|
||||
self.post(url='/service/{0}/invite/{1}'.format(service_id, invited_user_id),
|
||||
|
||||
Reference in New Issue
Block a user