mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-13 13:16:55 +03:00
Refactor Constants
This commit is contained in:
parent
0f85165b69
commit
60c4fe10b1
|
@ -135,6 +135,19 @@ IMPORT_STRINGS = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
SETTINGS_DOC = "http://www.django-rest-framework.org/api-guide/settings/"
|
||||||
|
|
||||||
|
|
||||||
|
# List of settings that have been depreceated
|
||||||
|
DEPRECEATED_SETTINGS = ()
|
||||||
|
|
||||||
|
|
||||||
|
# List of settings that have been removed
|
||||||
|
REMOVED_SETTINGS = (
|
||||||
|
"PAGINATE_BY", "PAGINATE_BY_PARAM", "MAX_PAGINATE_BY",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def perform_import(val, setting_name):
|
def perform_import(val, setting_name):
|
||||||
"""
|
"""
|
||||||
If the given setting is a string import notation,
|
If the given setting is a string import notation,
|
||||||
|
@ -207,10 +220,7 @@ class APISettings(object):
|
||||||
return val
|
return val
|
||||||
|
|
||||||
def __check_user_settings(self, user_settings):
|
def __check_user_settings(self, user_settings):
|
||||||
DEPRECEATED_SETTINGS = (
|
for setting in REMOVED_SETTINGS:
|
||||||
"PAGINATE_BY", "PAGINATE_BY_PARAM", "MAX_PAGINATE_BY",)
|
|
||||||
SETTINGS_DOC = "http://www.django-rest-framework.org/api-guide/settings/"
|
|
||||||
for setting in DEPRECEATED_SETTINGS:
|
|
||||||
if setting in user_settings:
|
if setting in user_settings:
|
||||||
raise AttributeError("The '%s' setting has been removed. Please refer to '%s' for available settings." % (setting, SETTINGS_DOC))
|
raise AttributeError("The '%s' setting has been removed. Please refer to '%s' for available settings." % (setting, SETTINGS_DOC))
|
||||||
return user_settings
|
return user_settings
|
||||||
|
|
Loading…
Reference in New Issue
Block a user