Commit 1a526ec6 authored by Lars Kruse's avatar Lars Kruse
Browse files

fix(settings): tolerate a missing "GROUPRISE" dictionary in settings

Most settings have reasonable defaults, thus the GROUPRISE dictionary is
not strictly required to be defined in the settings module.
parent d49e2418
......@@ -6,7 +6,10 @@ from django.conf import settings
from django.templatetags.static import static
_GR = settings.GROUPRISE
try:
_GR = settings.GROUPRISE
except AttributeError:
_GR = {}
class LazySettingsResolver:
......
......@@ -4,7 +4,10 @@ from django.contrib.sites.models import Site
from grouprise.core.settings import LazySettingsResolver
_MATRIX_SETTINGS = settings.GROUPRISE.get("MATRIX_CHAT", {})
try:
_MATRIX_SETTINGS = settings.GROUPRISE["MATRIX_CHAT"]
except (KeyError, AttributeError):
_MATRIX_SETTINGS = {}
MATRIX_SETTINGS = LazySettingsResolver(
......
......@@ -7,4 +7,9 @@ register = template.Library()
@register.simple_tag()
def target_audience():
return settings.GROUPRISE.get('TARGET_AUDIENCE', _('all'))
# We cannot use grouprise.core.settings.CORE_SETTINGS here, since the default value needs to be
# localized for each requester.
try:
return settings.GROUPRISE["TARGET_AUDIENCE"]
except (KeyError, AttributeError):
return _('all')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment