integrations: Store logo_path as an attribute along with logo_url.

Integrations can be supplied a logo parameter which is used to contruct
their `logo_url`. It would be useful to store this parameter, instead of
computing the path from the URL.
This commit is contained in:
Puneeth Chaganti 2020-05-15 13:13:39 +05:30 committed by Tim Abbott
parent 29f981c836
commit dfd4b4d051
1 changed files with 4 additions and 7 deletions

View File

@ -77,10 +77,8 @@ class Integration:
) )
self.categories = list(map((lambda c: CATEGORIES[c]), categories)) self.categories = list(map((lambda c: CATEGORIES[c]), categories))
if logo is None: self.logo_path = logo if logo is not None else self.get_logo_path()
self.logo_url = self.get_logo_url() self.logo_url = self.get_logo_url()
else:
self.logo_url = staticfiles_storage.url(logo)
if display_name is None: if display_name is None:
display_name = name.title() display_name = name.title()
@ -104,9 +102,8 @@ class Integration:
return None return None
def get_logo_url(self) -> Optional[str]: def get_logo_url(self) -> Optional[str]:
logo_path = self.get_logo_path() if self.logo_path is not None:
if logo_path is not None: return staticfiles_storage.url(self.logo_path)
return staticfiles_storage.url(logo_path)
return None return None