diff options
author | Gabriel Hurley <gabriel@strikeawe.com> | 2012-03-06 17:43:15 -0800 |
---|---|---|
committer | Gabriel Hurley <gabriel@strikeawe.com> | 2012-03-06 17:43:15 -0800 |
commit | a32f67967e4b1657fc35d9306ff342930719110d (patch) | |
tree | f3c8752d3340bbda56a5062c5d0ea6e173ddfe82 /horizon/exceptions.py | |
parent | 8ff0f46b46f9b0991d4cafe379122ad6befc1569 (diff) | |
download | horizon-a32f67967e4b1657fc35d9306ff342930719110d.tar.gz |
Minor extensibility improvements.
* Allow exceptions.handle to include user-defined exception types.
Fixes bug 948536.
* Adds a wrapper around the form/table header/table in the base
_data_table.html template for easier targeting/styling.
* Moves the rest of the main nav templating into a single template
for easier customization. Fixes bug 948508.
Change-Id: I045c29744ee01f60b080f2c1bbdc79ea5acf1b86
Diffstat (limited to 'horizon/exceptions.py')
-rw-r--r-- | horizon/exceptions.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/horizon/exceptions.py b/horizon/exceptions.py index cc1c93d04..8e27da74f 100644 --- a/horizon/exceptions.py +++ b/horizon/exceptions.py @@ -21,6 +21,7 @@ Exceptions raised by the Horizon code and the machinery for handling them. import logging import sys +from django.conf import settings from django.contrib import messages from django.utils.translation import ugettext as _ from cloudfiles import errors as swiftclient @@ -107,6 +108,10 @@ class HandledException(HorizonException): self.wrapped = wrapped +HORIZON_CONFIG = getattr(settings, "HORIZON_CONFIG", {}) +EXCEPTION_CONFIG = HORIZON_CONFIG.get("exceptions", {}) + + UNAUTHORIZED = (keystoneclient.Unauthorized, keystoneclient.Forbidden, novaclient.Unauthorized, @@ -115,12 +120,15 @@ UNAUTHORIZED = (keystoneclient.Unauthorized, glanceclient.NotAuthorized, swiftclient.AuthenticationFailed, swiftclient.AuthenticationError) +UNAUTHORIZED += tuple(EXCEPTION_CONFIG.get('unauthorized', [])) NOT_FOUND = (keystoneclient.NotFound, novaclient.NotFound, glanceclient.NotFound, swiftclient.NoSuchContainer, swiftclient.NoSuchObject) +NOT_FOUND += tuple(EXCEPTION_CONFIG.get('not_found', [])) + # NOTE(gabriel): This is very broad, and may need to be dialed in. RECOVERABLE = (keystoneclient.ClientException, @@ -128,6 +136,7 @@ RECOVERABLE = (keystoneclient.ClientException, glanceclient.GlanceException, swiftclient.Error, AlreadyExists) +RECOVERABLE += tuple(EXCEPTION_CONFIG.get('recoverable', [])) def handle(request, message=None, redirect=None, ignore=False, escalate=False): |