Allow the user defined CAS_COMPONENT_URLS to omit not changed values
This commit is contained in:
parent
14a459b128
commit
816156fa59
2 changed files with 13 additions and 6 deletions
|
@ -208,7 +208,7 @@ Template settings
|
||||||
Default is a key icon. Set it to ``False`` to disable it.
|
Default is a key icon. Set it to ``False`` to disable it.
|
||||||
* ``CAS_SHOW_POWERED``: Set it to ``False`` to hide the powered by footer. The default is ``True``.
|
* ``CAS_SHOW_POWERED``: Set it to ``False`` to hide the powered by footer. The default is ``True``.
|
||||||
* ``CAS_COMPONENT_URLS``: URLs to css and javascript external components. It is a dictionnary
|
* ``CAS_COMPONENT_URLS``: URLs to css and javascript external components. It is a dictionnary
|
||||||
and it must have the five following keys: ``"bootstrap3_css"``, ``"bootstrap3_js"``,
|
having the five following keys: ``"bootstrap3_css"``, ``"bootstrap3_js"``,
|
||||||
``"html5shiv"``, ``"respond"``, ``"jquery"``. The default is::
|
``"html5shiv"``, ``"respond"``, ``"jquery"``. The default is::
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -218,6 +218,7 @@ Template settings
|
||||||
"respond": "//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js",
|
"respond": "//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js",
|
||||||
"jquery": "//code.jquery.com/jquery.min.js",
|
"jquery": "//code.jquery.com/jquery.min.js",
|
||||||
}
|
}
|
||||||
|
if you omit some keys of the dictionnary, the default value for these keys is used.
|
||||||
|
|
||||||
* ``CAS_LOGIN_TEMPLATE``: Path to the template showed on ``/login`` then the user
|
* ``CAS_LOGIN_TEMPLATE``: Path to the template showed on ``/login`` then the user
|
||||||
is not autenticated. The default is ``"cas_server/login.html"``.
|
is not autenticated. The default is ``"cas_server/login.html"``.
|
||||||
|
|
|
@ -182,11 +182,17 @@ CAS_NEW_VERSION_JSON_URL = "https://pypi.python.org/pypi/django-cas-server/json"
|
||||||
|
|
||||||
GLOBALS = globals().copy()
|
GLOBALS = globals().copy()
|
||||||
for name, default_value in GLOBALS.items():
|
for name, default_value in GLOBALS.items():
|
||||||
|
# only care about parameter begining by CAS_
|
||||||
|
if name.startswith("CAS_"):
|
||||||
# get the current setting value, falling back to default_value
|
# get the current setting value, falling back to default_value
|
||||||
value = getattr(settings, name, default_value)
|
value = getattr(settings, name, default_value)
|
||||||
# set the setting value to its value if defined, ellse to the default_value.
|
# set the setting value to its value if defined, ellse to the default_value.
|
||||||
setattr(settings, name, value)
|
setattr(settings, name, value)
|
||||||
|
|
||||||
|
# Allow the user defined CAS_COMPONENT_URLS to omit not changed values
|
||||||
|
MERGED_CAS_COMPONENT_URLS = CAS_COMPONENT_URLS.copy()
|
||||||
|
MERGED_CAS_COMPONENT_URLS.update(settings.CAS_COMPONENT_URLS)
|
||||||
|
settings.CAS_COMPONENT_URLS = MERGED_CAS_COMPONENT_URLS
|
||||||
|
|
||||||
# if the federated mode is enabled, we must use the :class`cas_server.auth.CASFederateAuth` auth
|
# if the federated mode is enabled, we must use the :class`cas_server.auth.CASFederateAuth` auth
|
||||||
# backend.
|
# backend.
|
||||||
|
|
Loading…
Reference in a new issue