Safer query for request user for tests

This commit is contained in:
Mouse Reeve 2022-03-01 10:36:19 -08:00
parent f4dc07b6b9
commit 9422a07414

View file

@ -10,7 +10,7 @@ def site_settings(request): # pylint: disable=unused-argument
site = models.SiteSettings.objects.get() site = models.SiteSettings.objects.get()
theme = "css/themes/bookwyrm-light.scss" theme = "css/themes/bookwyrm-light.scss"
if request.user.is_authenticated and request.user.theme: if request.user and request.user.is_authenticated and request.user.theme:
theme = request.user.theme.path theme = request.user.theme.path
elif site.default_theme: elif site.default_theme:
theme = site.default_theme.path theme = site.default_theme.path