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')