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
This commit is contained in:
Lance Edgar 2017-08-15 16:13:35 -05:00
parent ec4e52fa1a
commit b309df005c

View file

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