From a5123479a6242b066cf8ddd6fac21f2e4fe20f92 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 2 Aug 2022 10:24:23 +1000 Subject: [PATCH] Return early if themes dir does not exist (#3452) --- InvenTree/common/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index b804123c69..88fa405b1e 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -1775,12 +1775,13 @@ class ColorTheme(models.Model): @classmethod def get_color_themes_choices(cls): """Get all color themes from static folder.""" - if settings.TESTING and not os.path.exists(settings.STATIC_COLOR_THEMES_DIR): + if not os.path.exists(settings.STATIC_COLOR_THEMES_DIR): logger.error('Theme directory does not exsist') return [] # Get files list from css/color-themes/ folder files_list = [] + for file in os.listdir(settings.STATIC_COLOR_THEMES_DIR): files_list.append(os.path.splitext(file))