comment cache decorator

This commit is contained in:
James Moffet
2022-07-19 18:31:01 -07:00
parent 845ecdd17f
commit f1d9aef9cd
12 changed files with 120 additions and 108 deletions

View File

@@ -3,18 +3,18 @@ from app.notify_client import NotifyAdminAPIClient, cache
class EmailBrandingClient(NotifyAdminAPIClient):
@cache.set('email_branding-{branding_id}')
# @cache.set('email_branding-{branding_id}')
def get_email_branding(self, branding_id):
return self.get(url='/email-branding/{}'.format(branding_id))
@cache.set('email_branding')
# @cache.set('email_branding')
def get_all_email_branding(self, sort_key=None):
brandings = self.get(url='/email-branding')['email_branding']
if sort_key and sort_key in brandings[0]:
brandings.sort(key=lambda branding: branding[sort_key].lower())
return brandings
@cache.delete('email_branding')
# @cache.delete('email_branding')
def create_email_branding(self, logo, name, text, colour, brand_type):
data = {
"logo": logo,
@@ -25,8 +25,8 @@ class EmailBrandingClient(NotifyAdminAPIClient):
}
return self.post(url="/email-branding", data=data)
@cache.delete('email_branding')
@cache.delete('email_branding-{branding_id}')
# @cache.delete('email_branding')
# @cache.delete('email_branding-{branding_id}')
def update_email_branding(self, branding_id, logo, name, text, colour, brand_type):
data = {
"logo": logo,