2015-01-28 17:50:14 +00:00
|
|
|
from django.conf import settings
|
|
|
|
|
|
|
|
|
2015-01-28 20:00:04 +00:00
|
|
|
# Here goes all the package default settings.
|
|
|
|
default_settings = {
|
|
|
|
'DOP_CODE_EXPIRE': 60*10, # 10 min.
|
|
|
|
'DOP_IDTOKEN_EXPIRE': 60*10, # 10 min.
|
|
|
|
'DOP_TOKEN_EXPIRE': 60*60, # 1 hour.
|
|
|
|
'LOGIN_URL': None,
|
|
|
|
'SITE_URL': None,
|
|
|
|
}
|
2015-01-28 17:50:14 +00:00
|
|
|
|
|
|
|
def get(name):
|
|
|
|
'''
|
|
|
|
Helper function to use inside the package.
|
|
|
|
'''
|
|
|
|
try:
|
2015-01-28 20:00:04 +00:00
|
|
|
value = default_settings[name]
|
2015-01-28 17:50:14 +00:00
|
|
|
value = getattr(settings, name)
|
|
|
|
except AttributeError:
|
|
|
|
if value == None:
|
|
|
|
raise Exception('You must set ' + name + ' in your settings.')
|
|
|
|
|
|
|
|
return value
|