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:
parent
2c46fde742
commit
1f752530d2
|
@ -91,15 +91,21 @@ def make_pyramid_config(settings):
|
|||
return pyramid_config
|
||||
|
||||
|
||||
def main(global_config, **settings):
|
||||
def main(global_config, views='tailbone.api', **settings):
|
||||
"""
|
||||
This function returns a Pyramid WSGI application.
|
||||
"""
|
||||
rattail_config = make_rattail_config(settings)
|
||||
pyramid_config = make_pyramid_config(settings)
|
||||
|
||||
# bring in some Tailbone
|
||||
pyramid_config.include('tailbone.subscribers')
|
||||
pyramid_config.include('tailbone.api')
|
||||
# event hooks
|
||||
pyramid_config.add_subscriber('tailbone.subscribers.new_request',
|
||||
'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()
|
||||
|
|
Loading…
Reference in a new issue