From add3baff745a276da424b3e73bcb7619ba5ca061 Mon Sep 17 00:00:00 2001 From: Bodnar Bogdan Date: Tue, 15 Aug 2017 17:52:12 +0200 Subject: [PATCH] Fix holding config variable in database through proxy objects A config variable may not necessarily be None when not configured. Can be stored in the database with the help of proxy objects, which can return the None value when accessed. For example, to integrate with jazzband/django-constance. --- analytical/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analytical/utils.py b/analytical/utils.py index d915cf4..b0841cf 100644 --- a/analytical/utils.py +++ b/analytical/utils.py @@ -21,8 +21,8 @@ def get_required_setting(setting, value_re, invalid_msg): value = getattr(settings, setting) except AttributeError: raise AnalyticalException("%s setting: not found" % setting) - if value is None: - raise AnalyticalException("%s setting is set to None" % setting) + if not value: + raise AnalyticalException("%s setting is not set" % setting) value = str(value) if not value_re.search(value): raise AnalyticalException("%s setting: %s: '%s'"