Previous Chapter | Next Chapter | Up | Next Section | Contents

Using document templates

To generate text using a document template, the document template must be called. Arguments may be provided to supply an object from which to get data, a mapping object to get data from, or keyword arguments containing additional data. The standard arguments for calling document templates are shown in table 13.

Standard arguments for calling document templates.

Argument number

Argument name




An object with attributes to be included in the document template namespace.

The client may be a single object, or a tuple of objects. If client is a tuple, then each object will be added to the document template namespace in order.



A mapping object with names and values to be added to the namespace.

Both of the standard arguments may be omitted. If the mapping argument is to be provided positionally without a client, then a None must be passed as the client value, as in:

return results(None, {'search_results': r})

Keyword arguments may be used to provide values, as in:

return results(search_results=r)

Previous Chapter | Next Chapter | Up | Next Section | Contents