~ubuntu-branches/ubuntu/quantal/horizon/quantal-security

« back to all changes in this revision

Viewing changes to horizon/exceptions.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-03-09 11:50:22 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20120309115022-ymiww5i58rbg97my
Tags: 2012.1~rc1~20120308.1479-0ubuntu1
* New upstream version.
* debian/rules: Fix symlink when installing horizon.
  (LP: #947118)
* debian/control: Add python-django-nose as a dep. (LP: #944235)
* debian/control: Fix broken depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import logging
22
22
import sys
23
23
 
 
24
from django.conf import settings
24
25
from django.contrib import messages
25
26
from django.utils.translation import ugettext as _
26
27
from cloudfiles import errors as swiftclient
107
108
        self.wrapped = wrapped
108
109
 
109
110
 
 
111
HORIZON_CONFIG = getattr(settings, "HORIZON_CONFIG", {})
 
112
EXCEPTION_CONFIG = HORIZON_CONFIG.get("exceptions", {})
 
113
 
 
114
 
110
115
UNAUTHORIZED = (keystoneclient.Unauthorized,
111
116
                keystoneclient.Forbidden,
112
117
                novaclient.Unauthorized,
115
120
                glanceclient.NotAuthorized,
116
121
                swiftclient.AuthenticationFailed,
117
122
                swiftclient.AuthenticationError)
 
123
UNAUTHORIZED += tuple(EXCEPTION_CONFIG.get('unauthorized', []))
118
124
 
119
125
NOT_FOUND = (keystoneclient.NotFound,
120
126
             novaclient.NotFound,
121
127
             glanceclient.NotFound,
122
128
             swiftclient.NoSuchContainer,
123
129
             swiftclient.NoSuchObject)
 
130
NOT_FOUND += tuple(EXCEPTION_CONFIG.get('not_found', []))
 
131
 
124
132
 
125
133
# NOTE(gabriel): This is very broad, and may need to be dialed in.
126
134
RECOVERABLE = (keystoneclient.ClientException,
128
136
               glanceclient.GlanceException,
129
137
               swiftclient.Error,
130
138
               AlreadyExists)
 
139
RECOVERABLE += tuple(EXCEPTION_CONFIG.get('recoverable', []))
131
140
 
132
141
 
133
142
def handle(request, message=None, redirect=None, ignore=False, escalate=False):