Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Removed Settings raise attribute error
  • Loading branch information
lsanpablo committed Dec 8, 2015
commit d86a901affd0ec7a0b229cf561838827808e6315
10 changes: 9 additions & 1 deletion rest_framework/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class APISettings(object):
"""
def __init__(self, user_settings=None, defaults=None, import_strings=None):
if user_settings:
self._user_settings = user_settings
self._user_settings = self.__check_user_settings(user_settings)
self.defaults = defaults or DEFAULTS
self.import_strings = import_strings or IMPORT_STRINGS

Expand Down Expand Up @@ -206,6 +206,14 @@ def __getattr__(self, attr):
setattr(self, attr, val)
return val

def __check_user_settings(self, user_settings):
DEPRECEATED_SETTINGS = (
"PAGINATE_BY", "PAGINATE_BY_PARAM", "MAX_PAGINATE_BY_SET",)
SETTINGS_DOC = "http://www.django-rest-framework.org/api-guide/settings/"
for setting in DEPRECEATED_SETTINGS:
if setting in user_settings:
raise AttributeError("The '%s' setting has been removed. Please refer to '%s' for available settings." % setting, SETTINGS_DOC)


api_settings = APISettings(None, DEFAULTS, IMPORT_STRINGS)

Expand Down