summaryrefslogtreecommitdiff
path: root/horizon/exceptions.py
diff options
context:
space:
mode:
authorGabriel Hurley <gabriel@strikeawe.com>2012-11-17 16:54:48 -0800
committerGabriel Hurley <gabriel@strikeawe.com>2012-11-20 14:29:05 -0800
commit0065e6642dafe2a43480d1e6280bff1128b33775 (patch)
treec6c9c0902178f9afdda8902754e6838423a4a866 /horizon/exceptions.py
parent0e328995ec3fa8a04af8b687d2a7462fd8029f1c (diff)
downloadhorizon-0065e6642dafe2a43480d1e6280bff1128b33775.tar.gz
Unifies Horizon conf.
Centralizes all of Horizon's configuration options so that they're all uniformly accesible from a single place and always guaranteed to exist. Implements blueprint unify-config. Change-Id: I3279b7ccd58302fcff4f0d273f89f282a285c442
Diffstat (limited to 'horizon/exceptions.py')
-rw-r--r--horizon/exceptions.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/horizon/exceptions.py b/horizon/exceptions.py
index 91c1118ff..313f0c5ac 100644
--- a/horizon/exceptions.py
+++ b/horizon/exceptions.py
@@ -22,7 +22,6 @@ import logging
import os
import sys
-from django.conf import settings
from django.contrib.auth import logout
from django.http import HttpRequest
from django.utils import termcolors
@@ -30,6 +29,7 @@ from django.utils.translation import ugettext as _
from django.views.debug import SafeExceptionReporterFilter, CLEANSED_SUBSTITUTE
from horizon import messages
+from horizon.conf import HORIZON_CONFIG
LOG = logging.getLogger(__name__)
PALETTE = termcolors.PALETTES[termcolors.DEFAULT_PALETTE]
@@ -194,12 +194,10 @@ class HandledException(HorizonException):
self.wrapped = wrapped
-HORIZON_CONFIG = getattr(settings, "HORIZON_CONFIG", {})
-EXCEPTION_CONFIG = HORIZON_CONFIG.get("exceptions", {})
-UNAUTHORIZED = tuple(EXCEPTION_CONFIG.get('unauthorized', []))
-NOT_FOUND = tuple(EXCEPTION_CONFIG.get('not_found', []))
+UNAUTHORIZED = tuple(HORIZON_CONFIG['exceptions']['unauthorized'])
+NOT_FOUND = tuple(HORIZON_CONFIG['exceptions']['not_found'])
RECOVERABLE = (AlreadyExists,)
-RECOVERABLE += tuple(EXCEPTION_CONFIG.get('recoverable', []))
+RECOVERABLE += tuple(HORIZON_CONFIG['exceptions']['recoverable'])
def error_color(msg):