Fix Exceptions doc page generation
The problem caused by circular import of django.contrib.auth by both horizon.exceptions and openstack_auth.utils (through openstack_dashboard.settings) Change-Id: I7ad178f5dd7f43bf95a3b2091113725c3415533f Closes-Bug: #1276243
This commit is contained in:
parent
5c6ca40b3c
commit
8a237ea34d
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue