Add oruga overhead for "classic" app only, not API
This commit is contained in:
parent
362d545f34
commit
358816d9e7
|
@ -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
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue