More idiomatic default settings
This commit is contained in:
parent
1cdc4a12d6
commit
744f12dccf
2 changed files with 4 additions and 6 deletions
|
@ -1,4 +1,2 @@
|
||||||
default_settings = {
|
LDAP_SERVER_URL = "ldaps://ldap.spi.ens.fr:636"
|
||||||
"LDAP_SERVER_URL": "ldaps://ldap.spi.ens.fr:636",
|
|
||||||
# TODO: CAS_SERVER_URL
|
# TODO: CAS_SERVER_URL
|
||||||
}
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import ldap
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
|
||||||
from authens.conf import default_settings
|
from authens import conf as default_conf
|
||||||
from authens.models import CASAccount, OldCASAccount
|
from authens.models import CASAccount, OldCASAccount
|
||||||
from authens.utils import parse_entrance_year
|
from authens.utils import parse_entrance_year
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ def fetch_cas_account(cas_login):
|
||||||
if not cas_login.isalnum():
|
if not cas_login.isalnum():
|
||||||
raise ValueError("Illegal CAS login: {}".format(cas_login))
|
raise ValueError("Illegal CAS login: {}".format(cas_login))
|
||||||
|
|
||||||
ldap_url = getattr(settings, "LDAP_SERVER_URL", default_settings["LDAP_SERVER_URL"])
|
ldap_url = getattr(settings, "LDAP_SERVER_URL", default_conf.LDAP_SERVER_URL)
|
||||||
ldap_obj = ldap.initialize(ldap_url)
|
ldap_obj = ldap.initialize(ldap_url)
|
||||||
res = ldap_obj.search_s(
|
res = ldap_obj.search_s(
|
||||||
"dc=spi,dc=ens,dc=fr",
|
"dc=spi,dc=ens,dc=fr",
|
||||||
|
|
Loading…
Reference in a new issue