From d86a901affd0ec7a0b229cf561838827808e6315 Mon Sep 17 00:00:00 2001 From: Luis San Pablo Date: Mon, 7 Dec 2015 21:45:44 -0600 Subject: [PATCH] Removed Settings raise attribute error --- rest_framework/settings.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rest_framework/settings.py b/rest_framework/settings.py index adf737126..188c130c0 100644 --- a/rest_framework/settings.py +++ b/rest_framework/settings.py @@ -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 @@ -206,6 +206,14 @@ class APISettings(object): 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)