Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default settings cleanup #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions oauthadmin/settings.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
from django.conf import settings as global_settings
from django.conf import settings as django_settings

defaults = {
# default values for all django-oauth2-admin settings
"GET_USER": 'oauthadmin.stubs.get_user',
"PING_INTERVAL": 300,
"OAUTHADMIN_DEFAULT_NEXT_URL": "/admin/",
# Default values for all django-oauth2-admin settings
DEFAULT_SETTINGS = {
'GET_USER': 'oauthadmin.stubs.get_user',
'PING_INTERVAL': 300,
'DEFAULT_NEXT_URL': '/admin/',
"SCOPE": ['default'],
}
OAUTHADMIN_SETTINGS_PREFIX = 'OAUTHADMIN_'

global_prefix = 'OAUTHADMIN_'

def app_setting(name):
return getattr(global_settings, global_prefix+name, defaults.get(name))
return getattr(
django_settings,
'{}{}'.format(OAUTHADMIN_SETTINGS_PREFIX, name),
DEFAULT_SETTINGS.get(name)
)