oslo_reports.views package

Submodules

oslo_reports.views.jinja_view module

Provides Jinja Views

This module provides views that utilize the Jinja templating system for serialization. For more information on Jinja, please see http://jinja.pocoo.org/ .

class oslo_reports.views.jinja_view.JinjaView(path=None, text=None)

Bases: object

A Jinja View

This view renders the given model using the provided Jinja template. The template can be given in various ways. If the VIEw_TEXT property is defined, that is used as template. Othewise, if a path parameter is passed to the constructor, that is used to load a file containing the template. If the path parameter is None, the text parameter is used as the template.

The leading newline character and trailing newline character are stripped from the template (provided they exist). Baseline indentation is also stripped from each line. The baseline indentation is determined by checking the indentation of the first line, after stripping off the leading newline (if any).

Parameters
  • path (str) – the path to the Jinja template

  • text (str) – the text of the Jinja template

property template

Get the Compiled Template

Gets the compiled template, using a cached copy if possible (stored in attr:_templatecache) or otherwise recompiling the template if the compiled template is not present or is invalid (due to attr:_regentemplate being set to True).

Returns

the compiled Jinja template

Return type

jinja2.Template

property text

Get the Template Text

Gets the text of the current template

Returns

the text of the Jinja template

Return type

str

Module contents

Provides predefined views

This module provides a collection of predefined views for use in reports. It is separated by type (xml, json, or text). Each type contains a submodule called ‘generic’ containing several basic, universal views for that type. There is also a predefined view that utilizes Jinja.