summaryrefslogtreecommitdiff
path: root/openstack_dashboard/context_processors.py
diff options
context:
space:
mode:
authorAkihiro Motoki <amotoki@gmail.com>2019-04-11 09:51:31 +0900
committerAkihiro Motoki <amotoki@gmail.com>2019-07-08 18:20:32 +0900
commit2f1e1899d34344bb04c27276a980b12d575ed150 (patch)
treee7d894165d989d1f15bfaa914b7bb9243cd9c632 /openstack_dashboard/context_processors.py
parent8653f718f209ce2351e0571286aee47b87e50cc1 (diff)
downloadhorizon-2f1e1899d34344bb04c27276a980b12d575ed150.tar.gz
Define default settings explicitly (openstack_dashboard 5/5)
This commit mainly covers settings in the remaining files under openstack_dashboard. Note that HORIZON_CONFIG, horizon and openstack_auth are not covered. They will be covered by follow-up patches. Part of blueprint ini-based-configuration Change-Id: Ibd70e030445a073d9a62da9867850f4893135a89
Diffstat (limited to 'openstack_dashboard/context_processors.py')
-rw-r--r--openstack_dashboard/context_processors.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/openstack_dashboard/context_processors.py b/openstack_dashboard/context_processors.py
index 08b7a9357..676e335e2 100644
--- a/openstack_dashboard/context_processors.py
+++ b/openstack_dashboard/context_processors.py
@@ -50,7 +50,7 @@ def openstack(request):
request.user.authorized_tenants if tenant.enabled]
# Region context/support
- available_regions = getattr(settings, 'AVAILABLE_REGIONS', [])
+ available_regions = settings.AVAILABLE_REGIONS
regions = {'support': len(available_regions) > 1,
'current': {'endpoint': request.session.get('region_endpoint'),
'name': request.session.get('region_name')},
@@ -84,19 +84,17 @@ def openstack(request):
context['regions'] = regions
# Adding webroot access
- context['WEBROOT'] = getattr(settings, "WEBROOT", "/")
+ context['WEBROOT'] = settings.WEBROOT
- user_menu_links = getattr(settings, "USER_MENU_LINKS", [])
-
- context['USER_MENU_LINKS'] = user_menu_links
+ context['USER_MENU_LINKS'] = settings.USER_MENU_LINKS
# Adding profiler support flag
- profiler_settings = getattr(settings, 'OPENSTACK_PROFILER', {})
- profiler_enabled = profiler_settings.get('enabled', False)
+ profiler_settings = settings.OPENSTACK_PROFILER
+ profiler_enabled = profiler_settings['enabled']
context['profiler_enabled'] = profiler_enabled
if profiler_enabled and 'profile_page' in request.COOKIES:
index_view_id = request.META.get(profiler.ROOT_HEADER, '')
- hmac_keys = profiler_settings.get('keys', [])
+ hmac_keys = profiler_settings['keys']
context['x_trace_info'] = profiler.update_trace_headers(
hmac_keys, parent_id=index_view_id)