sources/oauth: slugify provider type instead of just lowercase
This commit is contained in:
parent
b2c10e2387
commit
f4a676e2fb
|
@ -21,6 +21,5 @@ class PassbookSourceOAuthConfig(AppConfig):
|
||||||
for source_type in settings.PASSBOOK_SOURCES_OAUTH_TYPES:
|
for source_type in settings.PASSBOOK_SOURCES_OAUTH_TYPES:
|
||||||
try:
|
try:
|
||||||
import_module(source_type)
|
import_module(source_type)
|
||||||
LOGGER.info("Loaded source_type", source_class=source_type)
|
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
LOGGER.debug(exc)
|
LOGGER.debug(exc)
|
||||||
|
|
|
@ -35,7 +35,7 @@ class OAuthSource(Source):
|
||||||
"passbook_sources_oauth:oauth-client-login",
|
"passbook_sources_oauth:oauth-client-login",
|
||||||
kwargs={"source_slug": self.slug},
|
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,
|
name=self.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Source type manager"""
|
"""Source type manager"""
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
|
from django.utils.text import slugify
|
||||||
from structlog import get_logger
|
from structlog import get_logger
|
||||||
|
|
||||||
from passbook.sources.oauth.views.core import OAuthCallback, OAuthRedirect
|
from passbook.sources.oauth.views.core import OAuthCallback, OAuthRedirect
|
||||||
|
@ -36,7 +37,7 @@ class SourceTypeManager:
|
||||||
|
|
||||||
def get_name_tuple(self):
|
def get_name_tuple(self):
|
||||||
"""Get list of tuples of all registered names"""
|
"""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):
|
def find(self, source, kind):
|
||||||
"""Find fitting Source Type"""
|
"""Find fitting Source Type"""
|
||||||
|
|
Reference in a new issue