Provides Report classes
This module defines various classes representing reports and report sections. All reports take the form of a report class containing various report sections.
Bases: object
A Basic Report
A Basic Report consists of a collection of ReportSection objects, each of which contains a top-level model and generator. It collects these sections into a cohesive report which may then be serialized by calling run()
Add a section to the report
This method adds a section with the given view and generator to the report. An index may be specified to insert the section at a given location in the list; If no index is specified, the section is appended to the list. The view is called on the model which results from the generator when the report is run. A generator is simply a method or callable object which takes no arguments and returns a openstack.common.report.models.base.ReportModel or similar object.
Parameters: |
|
---|
Run the report
This method runs the report, having each section generate its data and serialize itself before joining the sections together. The BasicReport accomplishes the joining by joining the serialized sections together with newlines.
Return type: | str |
---|---|
Returns: | the serialized report |
Bases: nova.openstack.common.report.report.BasicReport
A Report of a Certain Type
A ReportOfType has a predefined type associated with it. This type is automatically propagated down to the each of the sections upon serialization by wrapping the generator for each section.
See also
Parameters: | tp (str) – the type of the report |
---|
Bases: object
A Report Section
A report section contains a generator and a top-level view. When something attempts to serialize the section by calling str() on it, the section runs the generator and calls the view on the resulting model.
See also
Parameters: |
|
---|
Bases: nova.openstack.common.report.report.ReportOfType
A Human-Readable Text Report
This class defines a report that is designed to be read by a human being. It has nice section headers, and a formatted title.
Parameters: | name (str) – the title of the report |
---|
Add a section to the report
This method adds a section with the given title, and generator to the report. An index may be specified to insert the section at a given location in the list; If no index is specified, the section is appended to the list. The view is called on the model which results from the generator when the report is run. A generator is simply a method or callable object which takes no arguments and returns a openstack.common.report.models.base.ReportModel or similar object.
The model is told to serialize as text (if possible) at serialization time by wrapping the generator. The view model’s attached view (if any) is wrapped in a openstack.common.report.views.text.header.TitledView
Parameters: |
|
---|