Code review comment for lp:~jakedahn/horizon/lp760239

Revision history for this message
Devin Carlen (devcamcar) wrote :

If you are getting redirected to "permission denied" text, then you aren't try/except'ing the error where it's happening.

Each view is wrapped with a decorator @handle_nova_error, like so:

@login_required
@handle_nova_error
def launch(request, project_id, image_id):
    ...

In django_nova/exceptions.py's handle_nova_error method, the following is done if a NovaUnauthorizedException bubbles up and isn't handled by the view itself (launch() in the example above).

def handle_nova_error(func):
    """
    Decorator for handling nova errors in a generalized way.
    """
    def decorator(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except NovaUnavailableError:
            return redirect('nova_unavailable')
    return decorator

So are you saying its never trapping the error and somehow isn't even rendering the permission_denied template?

review: Needs Fixing

« Back to merge proposal