-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Raise error when setting a removed rest_framework setting for #3644 #3715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d86a901
Removed Settings raise attribute error
lsanpablo 13c66b9
Return error
lsanpablo 03c7f14
Test case for settings check
lsanpablo 4e5c57a
type on test case
lsanpablo 1b3e433
--ammend
lsanpablo 9db4c2a
--ammend
lsanpablo 4be3535
Merge branch 'settings_errors' of github.com:Cheglader/django-rest-fr…
lsanpablo 5117dad
removed setting typo
lsanpablo 0f85165
Fixed num args for %
lsanpablo 60c4fe1
Refactor Constants
lsanpablo 5802dc0
Initial, fixes #3644
lsanpablo b6e59c3
Merge branch 'settings_errors' of github.com:Cheglader/django-rest-fr…
lsanpablo a615e37
Removed depreceated constant
lsanpablo fbd89d6
Moved SETTINGS_DOC
lsanpablo dab6bf4
Changed error to warning message
lsanpablo 62e2a97
Fixed import order settings
lsanpablo c389aeb
Lint import ordring
lsanpablo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,6 +135,19 @@ | |
| ) | ||
|
|
||
|
|
||
| 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): | ||
| """ | ||
| If the given setting is a string import notation, | ||
|
|
@@ -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)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.