Skip to content

Commit

Permalink
Merge pull request #1290 from chessbr/fix-blacklist-key
Browse files Browse the repository at this point in the history
Core: fix typo on settings name
  • Loading branch information
tulimaki committed Jun 15, 2018
2 parents 033c529 + 22732f3 commit a4a1def
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Unrealeased
When releasing next version, the "Unreleased" header will be replaced
with appropriate version header and this help text will be removed.

Core
~~~~

- Fixed typo on `SHUUP_PROVIDES_BLACKLIST` setting name

Admin
~~~~~

Expand Down
4 changes: 2 additions & 2 deletions doc/ref/provides.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ Blacklisting Provides
Shuup also supports blacklisting unwanted provides. This is useful when one want to disable
some features like shipping and payment methods provided by a single app. This way,
it is easy to select which provides should be loaded by Shuup.
To blacklist provides, you need to set a special Django setting named `SHUUP_PROVIDES_BACKLIST`:
To blacklist provides, you need to set a special Django setting named `SHUUP_PROVIDES_BLACKLIST`:

.. code-block:: python
SHUUP_PROVIDES_BACKLIST = {
SHUUP_PROVIDES_BLACKLIST = {
'service_provider_admin_form': [
'pigeon.admin_forms:PigeonShippingAdminForm'
]
Expand Down
4 changes: 2 additions & 2 deletions shuup/apps/provides.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def _get_provide_specs_from_apps(category):
:return: List of spec strings.
:rtype: list[str]
"""
provides_black_list = getattr(settings, "SHUUP_PROVIDES_BACKLIST", {})
provides_black_list = getattr(settings, "SHUUP_PROVIDES_BLACKLIST", {})
if not isinstance(provides_black_list, dict):
raise ImproperlyConfigured("The setting `SHUUP_PROVIDES_BACKLIST` MUST be a dictionary.")
raise ImproperlyConfigured("The setting `SHUUP_PROVIDES_BLACKLIST` MUST be a dictionary.")

if category not in _provide_specs: # (Re)load required?
provide_list = []
Expand Down
4 changes: 2 additions & 2 deletions shuup_tests/core/test_provides.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_provides():
def test_blacklist_provides():
with override_settings(
INSTALLED_APPS=["shuup_tests.core"],
SHUUP_PROVIDES_BACKLIST={
SHUUP_PROVIDES_BLACKLIST={
"module_test_module": [
"shuup_tests.core.module_test_module:ModuleTestModule"
]
Expand All @@ -68,7 +68,7 @@ def test_blacklist_provides():
assert "ModuleTestModule" not in provides

# invalid object
with override_settings(SHUUP_PROVIDES_BACKLIST=["invalid"]):
with override_settings(SHUUP_PROVIDES_BLACKLIST=["invalid"]):
from shuup.apps.provides import clear_provides_cache
clear_provides_cache()
with pytest.raises(ImproperlyConfigured):
Expand Down

0 comments on commit a4a1def

Please sign in to comment.