diff options
author | Gabriel Hurley <gabriel@strikeawe.com> | 2012-08-05 12:52:21 -0700 |
---|---|---|
committer | Gabriel Hurley <gabriel@strikeawe.com> | 2012-08-05 12:56:32 -0700 |
commit | 30b58e2d03ecda7c8a227b10b4f014eeb7d4dd07 (patch) | |
tree | 15e33bc37263ef2b210b28c63d4abf1e84ce5b91 /horizon/exceptions.py | |
parent | 2f0678db4543a1a06bd19d8185028680a5318ddd (diff) | |
download | horizon-30b58e2d03ecda7c8a227b10b4f014eeb7d4dd07.tar.gz |
Separate OpenStack exceptions from Horizon exceptions.
Placing the OpenStack exception class definitions into their
own module inside the openstack_dashboard project allows
more flexibility for deployers and others who might wish
to use the horizon module for non-OpenStack Django projects.
The patch also contains two tiny cleanup items in the
templatetag files.
Change-Id: I8b250804ad07027d40d554ad1e7ee0b5af63d466
Diffstat (limited to 'horizon/exceptions.py')
-rw-r--r-- | horizon/exceptions.py | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/horizon/exceptions.py b/horizon/exceptions.py index fa799625e..f31455bb2 100644 --- a/horizon/exceptions.py +++ b/horizon/exceptions.py @@ -28,11 +28,6 @@ from django.utils import termcolors from django.utils.translation import ugettext as _ from django.views.debug import SafeExceptionReporterFilter, CLEANSED_SUBSTITUTE -from cloudfiles import errors as swiftclient -from glanceclient.common import exceptions as glanceclient -from keystoneclient import exceptions as keystoneclient -from novaclient import exceptions as novaclient - from horizon import messages LOG = logging.getLogger(__name__) @@ -200,33 +195,9 @@ class HandledException(HorizonException): HORIZON_CONFIG = getattr(settings, "HORIZON_CONFIG", {}) EXCEPTION_CONFIG = HORIZON_CONFIG.get("exceptions", {}) - - -UNAUTHORIZED = (keystoneclient.Unauthorized, - keystoneclient.Forbidden, - novaclient.Unauthorized, - novaclient.Forbidden, - glanceclient.Unauthorized, - 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, - # AuthorizationFailure is raised when Keystone is "unavailable". - keystoneclient.AuthorizationFailure, - novaclient.ClientException, - glanceclient.ClientException, - swiftclient.Error, - AlreadyExists) +UNAUTHORIZED = tuple(EXCEPTION_CONFIG.get('unauthorized', [])) +NOT_FOUND = tuple(EXCEPTION_CONFIG.get('not_found', [])) +RECOVERABLE = (AlreadyExists,) RECOVERABLE += tuple(EXCEPTION_CONFIG.get('recoverable', [])) |