From 8de2a2423582748fbe10346d7fb0cadf2bee1d3f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 21 Oct 2021 18:12:10 +0100 Subject: [PATCH] Check that lists exist before adding header --- webapp_profile.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/webapp_profile.py b/webapp_profile.py index 4cf45c2ef..15320c01c 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -1675,10 +1675,7 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str, 'userAgentsBlockedStr', userAgentsBlockedStr, 200, '', False) - idx = 'Add content warnings for the following sites' - editProfileForm += \ - '\n' - + CWlistsStr = '' for listName, item in CWlists.items(): name = listName variableName = 'list' + name.replace(' ', '').replace("'", '') @@ -1688,7 +1685,12 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str, listIsEnabled = False if translate.get(name): name = translate[name] - editProfileForm += editCheckBox(name, variableName, listIsEnabled) + CWlistsStr += editCheckBox(name, variableName, listIsEnabled) + if CWlistsStr: + idx = 'Add content warnings for the following sites' + editProfileForm += \ + '\n' + \ + CWlistsStr editProfileForm += endEditSection() return editProfileForm