From cfc8ab629826cb407fb7189b61e3bed56a97a2b4 Mon Sep 17 00:00:00 2001 From: Zainab Amir Date: Wed, 1 Sep 2021 11:29:39 +0500 Subject: [PATCH] fix: remove edX support URL from login page (#28577) --- .../js/student_account/views/LoginView.js | 3 +-- .../djangoapps/site_configuration/helpers.py | 25 +++++++++++-------- .../site_configuration/tests/test_helpers.py | 4 +++ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lms/static/js/student_account/views/LoginView.js b/lms/static/js/student_account/views/LoginView.js index 812435a89f..1918278184 100644 --- a/lms/static/js/student_account/views/LoginView.js +++ b/lms/static/js/student_account/views/LoginView.js @@ -225,14 +225,13 @@ { email: error.responseJSON.email, platform_name: this.platform_name, - support_url: 'https://support.edx.org/', line_break: HtmlUtils.HTML('
'), strong_start: HtmlUtils.HTML(''), strong_end: HtmlUtils.HTML(''), anchorStart: HtmlUtils.HTML( StringUtils.interpolate( '', { - SupportUrl: 'https://support.edx.org/' + SupportUrl: this.supportURL, } ) ), diff --git a/openedx/core/djangoapps/site_configuration/helpers.py b/openedx/core/djangoapps/site_configuration/helpers.py index 7768a512ad..bee1d825ca 100644 --- a/openedx/core/djangoapps/site_configuration/helpers.py +++ b/openedx/core/djangoapps/site_configuration/helpers.py @@ -134,18 +134,21 @@ def get_value(val_name, default=None, **kwargs): # lint-amnesty, pylint: disabl else: configuration_value = default - # Attempt to perform a dictionary update using the provided default - # This will fail if the default value is not a dictionary - try: - value = dict(default) - value.update(configuration_value) - - # If the dictionary update fails, just use the configuration value - # TypeError: default is not iterable (simple value or None) - # ValueError: default is iterable but not a dict (list, not dict) - # AttributeError: default does not have an 'update' method - except (TypeError, ValueError, AttributeError): + if default == '': value = configuration_value + else: + # Attempt to perform a dictionary update using the provided default + # This will fail if the default value is not a dictionary + try: + value = dict(default) + value.update(configuration_value) + + # If the dictionary update fails, just use the configuration value + # TypeError: default is not iterable (simple value or None) + # ValueError: default is iterable but not a dict (list, not dict) + # AttributeError: default does not have an 'update' method + except (TypeError, ValueError, AttributeError): + value = configuration_value # Return the end result to the caller return value diff --git a/openedx/core/djangoapps/site_configuration/tests/test_helpers.py b/openedx/core/djangoapps/site_configuration/tests/test_helpers.py index 2b5215a8ec..1eaa5a1000 100644 --- a/openedx/core/djangoapps/site_configuration/tests/test_helpers.py +++ b/openedx/core/djangoapps/site_configuration/tests/test_helpers.py @@ -67,6 +67,10 @@ class TestHelpers(TestCase): # Test that the default value is returned if the value for the given key is not found in the configuration assert configuration_helpers.get_value('non_existent_name', 'dummy-default-value') == 'dummy-default-value' + # Test that correct default value is returned + assert configuration_helpers.get_value('non_existent_name', '') == '' + assert configuration_helpers.get_value('non_existent_name', None) is None + @with_site_configuration(configuration=test_config) def test_get_dict(self): """