Merge "Fix Exceptions doc page generation"

This commit is contained in:
Jenkins 2014-03-29 00:43:10 +00:00 committed by Gerrit Code Review
commit 463fbecc07
1 changed files with 6 additions and 1 deletions

View File

@ -22,7 +22,6 @@ import logging
import os
import sys
from django.contrib.auth import logout # noqa
from django.core.management import color_style # noqa
from django.http import HttpRequest # noqa
from django.utils.translation import ugettext_lazy as _
@ -283,6 +282,12 @@ def handle(request, message=None, redirect=None, ignore=False,
# Escalation means logging the user out and raising NotAuthorized
# so the middleware will redirect them appropriately.
if escalate:
# Prevents creation of circular import. django.contrib.auth
# requires openstack_dashboard.settings to be loaded (by trying to
# access settings.CACHES in in django.core.caches) while
# openstack_dashboard.settings requires django.contrib.auth to be
# loaded while importing openstack_auth.utils
from django.contrib.auth import logout # noqa
logout(request)
raise NotAuthorized
# Otherwise continue and present our "unauthorized" error message.