fix: avoid before_render subscriber hook for web API

the purpose of that function is to setup extra template context, but
API views always render as 'json' with no template
This commit is contained in:
Lance Edgar 2024-08-10 13:49:41 -05:00
parent 2c46fde742
commit 1f752530d2

View file

@ -91,15 +91,21 @@ def make_pyramid_config(settings):
return pyramid_config return pyramid_config
def main(global_config, **settings): def main(global_config, views='tailbone.api', **settings):
""" """
This function returns a Pyramid WSGI application. This function returns a Pyramid WSGI application.
""" """
rattail_config = make_rattail_config(settings) rattail_config = make_rattail_config(settings)
pyramid_config = make_pyramid_config(settings) pyramid_config = make_pyramid_config(settings)
# bring in some Tailbone # event hooks
pyramid_config.include('tailbone.subscribers') pyramid_config.add_subscriber('tailbone.subscribers.new_request',
pyramid_config.include('tailbone.api') 'pyramid.events.NewRequest')
# TODO: is this really needed?
pyramid_config.add_subscriber('tailbone.subscribers.context_found',
'pyramid.events.ContextFound')
# views
pyramid_config.include(views)
return pyramid_config.make_wsgi_app() return pyramid_config.make_wsgi_app()