The oslo_reports.views.jinja_view Module

The 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
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
text

Get the Template Text

Gets the text of the current template

Returns:the text of the Jinja template
Return type:str
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.