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
Prev Previous commit
Next Next commit
Refactor Constants
  • Loading branch information
lsanpablo committed Dec 8, 2015
commit 60c4fe10b1af61fdc859ab8ec969ae5915efdb66
18 changes: 14 additions & 4 deletions rest_framework/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@
)


SETTINGS_DOC = "http://www.django-rest-framework.org/api-guide/settings/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's required to make it a setting.



# 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):
"""
If the given setting is a string import notation,
Expand Down Expand Up @@ -207,10 +220,7 @@ def __getattr__(self, attr):
return val

def __check_user_settings(self, user_settings):
DEPRECEATED_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:
for setting in REMOVED_SETTINGS:
if setting in user_settings:
raise AttributeError("The '%s' setting has been removed. Please refer to '%s' for available settings." % (setting, SETTINGS_DOC))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want a hard crash or simply a big priority deprecation warning ?

return user_settings
Expand Down