Return early if themes dir does not exist (#3452)

This commit is contained in:
Oliver 2022-08-02 10:24:23 +10:00 committed by GitHub
parent ef12a834e0
commit a5123479a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))