From 0887c2b8dfd058045ef76656aa5f8dfab5e1c14b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20K=C5=99iv=C3=A1k?= Date: Mon, 19 Oct 2015 14:14:59 +0200 Subject: [PATCH] Fix home button in 500 page Currently, 500 page uses WEBROOT to set home link where WEBROOT is being taken from horizon.conf module. However, this module sets only HORIZON_CONFIG. As a result, 500 page is rendered with empty link, pointing home button to current page. This patch loads WEBROOT to horizon.conf, so it can be used in template for 500 error page. Change-Id: Icdd23703527a09a61d1326992b25a1004713444e Closes-Bug: 1507563 --- horizon/conf/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/horizon/conf/__init__.py b/horizon/conf/__init__.py index 73a3af5c4e..da5e9cc383 100644 --- a/horizon/conf/__init__.py +++ b/horizon/conf/__init__.py @@ -14,6 +14,7 @@ import copy from django.utils.functional import empty # noqa from django.utils.functional import LazyObject # noqa +from django.utils.functional import SimpleLazyObject # noqa class LazySettings(LazyObject): @@ -44,4 +45,11 @@ class LazySettings(LazyObject): self._setup(name) return self._wrapped.get(name, fallback) + +def get_webroot(): + from django.conf import settings + return settings.WEBROOT + + HORIZON_CONFIG = LazySettings() +WEBROOT = SimpleLazyObject(get_webroot)