oslo_reports.models.with_default_views
Module¶oslo_reports.models.with_default_views.
ModelWithDefaultViews
(*args, **kwargs)¶Bases: oslo_reports.models.base.ReportModel
A Model With Default Views of Various Types
A model with default views has several predefined views, each associated with a given type. This is often used for when a submodel should have an attached view, but the view differs depending on the serialization format
Parameters are as the superclass, except for any parameters ending in ‘_view’: these parameters get stored as default views.
The default ‘default views’ are
to_type
()¶(‘type’ is one of the ‘default views’ defined for this model) Serializes this model using the default view for ‘type’
str
this model serialized as ‘type’
set_current_view_type
(tp, visited=None)¶Set the current view type
This method attempts to set the current view type for this model and all submodels by calling itself recursively on all values, traversing intervening sequences and mappings when possible, and ignoring all other objects.
tp – the type of the view (‘text’, ‘json’, ‘xml’, etc)
visited – a set of object ids for which the corresponding objects have already had their view type set
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.