Skip to content
Snippets Groups Projects
Unverified Commit fdab6a35 authored by Troy Sankey's avatar Troy Sankey Committed by GitHub
Browse files

Merge pull request #17769 from edx/pwnage101/fix-maintenance-banner

add missing maintenance banner settings
parents 187e39ff 9f30a75a
No related branches found
No related tags found
No related merge requests found
......@@ -1091,6 +1091,9 @@ COMPLETION_BY_VIEWING_DELAY_MS = ENV_TOKENS.get('COMPLETION_BY_VIEWING_DELAY_MS'
############### Settings for django-fernet-fields ##################
FERNET_KEYS = AUTH_TOKENS.get('FERNET_KEYS', FERNET_KEYS)
################# Settings for the maintenance banner #################
MAINTENANCE_BANNER_TEXT = ENV_TOKENS.get('MAINTENANCE_BANNER_TEXT', None)
############################### Plugin Settings ###############################
from openedx.core.djangoapps.plugins import plugin_settings, constants as plugin_constants
......
......@@ -35,9 +35,9 @@ def add_maintenance_banner(func):
@wraps(func)
def _decorated(request, *args, **kwargs): # pylint: disable=missing-docstring
if waffle().is_enabled(DISPLAY_MAINTENANCE_WARNING):
if hasattr(settings, 'EDXAPP_MAINTENANCE_BANNER_TEXT') and settings.EDXAPP_MAINTENANCE_BANNER_TEXT:
if hasattr(settings, 'MAINTENANCE_BANNER_TEXT') and settings.MAINTENANCE_BANNER_TEXT:
# The waffle switch is enabled and the banner text is defined
# and non-empty. We can now register the message:
PageLevelMessages.register_warning_message(request, settings.EDXAPP_MAINTENANCE_BANNER_TEXT)
PageLevelMessages.register_warning_message(request, settings.MAINTENANCE_BANNER_TEXT)
return func(request, *args, **kwargs)
return _decorated
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment