From f4a676e2fb8b3c3698534f626ca5455326a887e0 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 23 Feb 2020 13:53:16 +0100 Subject: [PATCH] sources/oauth: slugify provider type instead of just lowercase --- passbook/sources/oauth/apps.py | 1 - passbook/sources/oauth/models.py | 2 +- passbook/sources/oauth/types/manager.py | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/passbook/sources/oauth/apps.py b/passbook/sources/oauth/apps.py index a784cb22a..360cefcec 100644 --- a/passbook/sources/oauth/apps.py +++ b/passbook/sources/oauth/apps.py @@ -21,6 +21,5 @@ class PassbookSourceOAuthConfig(AppConfig): for source_type in settings.PASSBOOK_SOURCES_OAUTH_TYPES: try: import_module(source_type) - LOGGER.info("Loaded source_type", source_class=source_type) except ImportError as exc: LOGGER.debug(exc) diff --git a/passbook/sources/oauth/models.py b/passbook/sources/oauth/models.py index 765e87ba9..d8b605260 100644 --- a/passbook/sources/oauth/models.py +++ b/passbook/sources/oauth/models.py @@ -35,7 +35,7 @@ class OAuthSource(Source): "passbook_sources_oauth:oauth-client-login", kwargs={"source_slug": self.slug}, ), - icon_path=f"passbook/sources/{self.provider_type.replace(' ', '-')}.svg", + icon_path=f"passbook/sources/{self.provider_type}.svg", name=self.name, ) diff --git a/passbook/sources/oauth/types/manager.py b/passbook/sources/oauth/types/manager.py index deed4cb1a..76d734d87 100644 --- a/passbook/sources/oauth/types/manager.py +++ b/passbook/sources/oauth/types/manager.py @@ -1,6 +1,7 @@ """Source type manager""" from enum import Enum +from django.utils.text import slugify from structlog import get_logger from passbook.sources.oauth.views.core import OAuthCallback, OAuthRedirect @@ -36,7 +37,7 @@ class SourceTypeManager: def get_name_tuple(self): """Get list of tuples of all registered names""" - return [(x.lower(), x) for x in set(self.__names)] + return [(slugify(x), x) for x in set(self.__names)] def find(self, source, kind): """Find fitting Source Type"""