2018-11-16 08:10:35 +00:00
|
|
|
"""passbook mod saml_idp app config"""
|
2018-11-16 09:08:15 +00:00
|
|
|
from importlib import import_module
|
|
|
|
from logging import getLogger
|
2018-11-16 08:10:35 +00:00
|
|
|
|
2018-11-16 09:08:15 +00:00
|
|
|
from django.apps import AppConfig
|
2018-11-16 08:10:35 +00:00
|
|
|
|
2018-11-16 09:08:15 +00:00
|
|
|
from passbook.lib.config import CONFIG
|
|
|
|
|
|
|
|
LOGGER = getLogger(__name__)
|
2018-11-16 08:10:35 +00:00
|
|
|
|
|
|
|
class PassbookSAMLIDPConfig(AppConfig):
|
|
|
|
"""passbook saml_idp app config"""
|
|
|
|
|
|
|
|
name = 'passbook.saml_idp'
|
|
|
|
label = 'passbook_saml_idp'
|
|
|
|
verbose_name = 'passbook SAML IDP'
|
2018-11-16 09:08:15 +00:00
|
|
|
|
|
|
|
def ready(self):
|
|
|
|
"""Load source_types from config file"""
|
|
|
|
source_types_to_load = CONFIG.y('saml_idp.types', [])
|
|
|
|
for source_type in source_types_to_load:
|
|
|
|
try:
|
|
|
|
import_module(source_type)
|
|
|
|
LOGGER.info("Loaded %s", source_type)
|
|
|
|
except ImportError as exc:
|
|
|
|
LOGGER.debug(exc)
|