HTTP request and response¶
Websauna uses Pyramid’s request processing.
Request and response¶
The incoming HTTP request is an instance of websauna.system.http.Request
.
When your view function returns
If the return value is instance of
pyramid.response.Response
it is processed as isIf the return value is a dictionary, as usually it is to pass template context variables to template rendering, a corresponding renderer is invoked to turn the context to a response. The
renderer
argument to view configuration is a template name. The template engine loads this template and passes the view return value to it as template context.
Routing¶
Routing to a corresponding view function or class is done by Pyramid’s routing mechanism (URL dispatch <http://docs.pylonsproject.org/projects/pyramid//en/latest/narr/urldispatch.html>, traversal). You set up this in Initializer.
Related methods include
pyramid.configurator.Configurator.add_view()
pyramid.configurator.Configurator.add_route()