From 5d04de936bc7bb90dff0986b902227580cb9203d Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 10 Mar 2019 16:36:16 -0500 Subject: [PATCH] Allow apps to set background color per request --- tailbone/subscribers.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tailbone/subscribers.py b/tailbone/subscribers.py index 707de1e0..de1177d6 100644 --- a/tailbone/subscribers.py +++ b/tailbone/subscribers.py @@ -124,8 +124,12 @@ def before_render(event): renderer_globals['messaging_enabled'] = request.rattail_config.getbool( 'tailbone', 'messaging.enabled', default=False) - renderer_globals['background_color'] = request.rattail_config.get( - 'tailbone', 'background_color') + # background color may be set per-request, by some apps + if hasattr(request, 'background_color') and request.background_color: + renderer_globals['background_color'] = request.background_color + else: # otherwise we use the one from config + renderer_globals['background_color'] = request.rattail_config.get( + 'tailbone', 'background_color') def add_inbox_count(event):