From b309df005c42a363a5444ef114618fa2aff5c9b9 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 15 Aug 2017 16:13:35 -0500 Subject: [PATCH] Tweak how pyramid config is created during app startup, for tests still not sure if this is quite right, but seems to work for now --- tailbone/app.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tailbone/app.py b/tailbone/app.py index 419c9b70..3ccf4ab2 100644 --- a/tailbone/app.py +++ b/tailbone/app.py @@ -125,11 +125,15 @@ def make_pyramid_config(settings): from tailbone.forms.alchemy import TemplateEngine from tailbone.forms import renderers - config = Configurator(settings=settings, root_factory=Root) + config = settings.pop('pyramid_config', None) + if config: + config.set_root_factory(Root) + else: + config = Configurator(settings=settings, root_factory=Root) - # Configure user authentication / authorization. - config.set_authentication_policy(SessionAuthenticationPolicy()) + # configure user authorization / authentication config.set_authorization_policy(TailboneAuthorizationPolicy()) + config.set_authentication_policy(SessionAuthenticationPolicy()) # always require CSRF token protection config.set_default_csrf_options(require_csrf=True, token='_csrf')