watson.framework.views.decorators

watson.framework.views.decorators.view(template=None, format=None, renderer_args=None)[source]

Return the view model in a specific format and with a specific template.

This will not work if the response returned from the controller is of the watson.http.messages.Response type.

Parameters:
  • func (callable) – the function that is being wrapped
  • template (string) – the template to use
  • format (string) – the format to output as
  • renderer_args (mixed) – args to be passed to the renderer
Returns:

The view model in the specific format

Example:

class MyClass(controllers.Rest):
    @view(template='edit')
    def create_action(self):
        return 'something'