morepath.publish – Web publisher¶
Functionality to turn a
morepath.Request into a
morepath.Response using Morepath configuration. It looks up a
model instance for the request path and parameters, then looks up a
view for that model object to create the response.
The publish module:
- resolves the request into a model object.
- resolves the model object and the request into a view.
- the view then generates a response.
It all starts at
Determine view name from leftover stack of path segments
Parameters: stack – a list of path segments left over after consuming the path. Returns: view name string or
Noneif no view name can be determined.
Handle request and return response.
Resolve request to a model object.
This takes the path information as a stack of path segments in
morepath.Request.unconsumedand consumes it step by step using
morepath.TrajectRegistry.consume()to find the model object as declared by
morepath.App.path()directive. It can traverse through mounted applications as indicated by the
Returns: model object or
Noneif not found.
Given model object and request, create response.
get_view_name()to set up the view name on the request object.
If no view name exist it raises
It then uses
morepath.App.get_view()to resolve the view for the model object and the request by doing dynamic dispatch.
- obj – model object to get response for.
- request –