summaryrefslogtreecommitdiff
path: root/horizon/context_processors.py
diff options
context:
space:
mode:
authorGabriel Hurley <gabriel@strikeawe.com>2012-10-04 15:43:40 -0700
committerGabriel Hurley <gabriel@strikeawe.com>2012-10-11 11:47:50 -0700
commitcb8e7c1f8f0b238b88253cd6d82092cbe530ba9e (patch)
tree9ee3463e05ae6cf2f9cee5309a648538471c02b9 /horizon/context_processors.py
parentef1e1d9b7a1fd4140518318ead8b7174a6a434ab (diff)
downloadhorizon-cb8e7c1f8f0b238b88253cd6d82092cbe530ba9e.tar.gz
Splits OpenStack Dashboard bits from framework app code.
Moves everything OpenStack-specific (dashboards, apis, etc.) into the openstack_dashboard project, achieving a much cleaner separation between the project-specific code and the generic Horizon framework code. Change-Id: I7235b41d449b26c980668fc3eb4360b24508717b
Diffstat (limited to 'horizon/context_processors.py')
-rw-r--r--horizon/context_processors.py36
1 files changed, 3 insertions, 33 deletions
diff --git a/horizon/context_processors.py b/horizon/context_processors.py
index 0ac7e7ce8..8e65db2f0 100644
--- a/horizon/context_processors.py
+++ b/horizon/context_processors.py
@@ -21,29 +21,15 @@
Context processors used by Horizon.
"""
-import logging
-
from django.conf import settings
-LOG = logging.getLogger(__name__)
-
-
def horizon(request):
""" The main Horizon context processor. Required for Horizon to function.
- The following variables are added to the request context:
-
- ``authorized_tenants``
- A list of tenant objects which the current user has access to.
-
- ``regions``
-
- A dictionary containing information about region support, the current
- region, and available regions.
-
- Additionally, it sets the names ``True`` and ``False`` in the context
- to their boolean equivalents for convenience.
+ It adds the Horizon config to the context as well as setting the names
+ ``True`` and ``False`` in the context to their boolean equivalents
+ for convenience.
.. warning::
@@ -55,20 +41,4 @@ def horizon(request):
"True": True,
"False": False}
- # Auth/Keystone context
- context.setdefault('authorized_tenants', [])
- current_dash = request.horizon['dashboard']
- needs_tenants = getattr(current_dash, 'supports_tenants', False)
- if request.user.is_authenticated() and needs_tenants:
- context['authorized_tenants'] = request.user.authorized_tenants
-
- # Region context/support
- available_regions = getattr(settings, 'AVAILABLE_REGIONS', [])
- regions = {'support': len(available_regions) > 1,
- 'current': {'endpoint': request.session.get('region_endpoint'),
- 'name': request.session.get('region_name')},
- 'available': [{'endpoint': region[0], 'name':region[1]} for
- region in available_regions]}
- context['regions'] = regions
-
return context