diff --git a/tailbone/app.py b/tailbone/app.py index abf2fa09..63610f85 100644 --- a/tailbone/app.py +++ b/tailbone/app.py @@ -123,6 +123,9 @@ def make_pyramid_config(settings, configure_csrf=True): config.set_root_factory(Root) else: + # declare this web app of the "classic" variety + settings.setdefault('tailbone.classic', 'true') + # we want the new themes feature! establish_theme(settings) @@ -130,6 +133,7 @@ def make_pyramid_config(settings, configure_csrf=True): config = Configurator(settings=settings, root_factory=Root) # add rattail config directly to registry + # TODO: why on earth do we do this again? config.registry['rattail_config'] = rattail_config # configure user authorization / authentication diff --git a/tailbone/subscribers.py b/tailbone/subscribers.py index 9b56335a..8d10eb0b 100644 --- a/tailbone/subscribers.py +++ b/tailbone/subscribers.py @@ -98,10 +98,14 @@ def new_request(event): request.set_property(user, reify=True) - def use_oruga(request): - return should_use_oruga(request) + # nb. only add oruga check for "classic" web app + classic = rattail_config.parse_bool(request.registry.settings.get('tailbone.classic')) + if classic: - request.set_property(use_oruga, reify=True) + def use_oruga(request): + return should_use_oruga(request) + + request.set_property(use_oruga, reify=True) # assign client IP address to the session, for sake of versioning Session().continuum_remote_addr = request.client_addr @@ -173,11 +177,11 @@ def before_render(event): renderer_globals['colander'] = colander renderer_globals['deform'] = deform renderer_globals['csrf_header_name'] = csrf_header_name(request.rattail_config) - renderer_globals['b'] = 'o' if request.use_oruga else 'b' # for buefy # theme - we only want do this for classic web app, *not* API # TODO: so, clearly we need a better way to distinguish the two if 'tailbone.theme' in request.registry.settings: + renderer_globals['b'] = 'o' if request.use_oruga else 'b' # for buefy renderer_globals['theme'] = request.registry.settings['tailbone.theme'] # note, this is just a global flag; user still needs permission to see picker expose_picker = request.rattail_config.getbool('tailbone', 'themes.expose_picker',