Commit 8b57eedb authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[doc] cubicweb.view documentation (closes: #2099962)

--HG--
branch : stable
parent 3f87aa655466
......@@ -35,30 +35,7 @@ Basic class for views
Class `View` (`cubicweb.view`)
```````````````````````````````
This class is an abstraction of a view class, used as a base class for
every renderable object such as views, templates and other user
interface components.
A `View` is instantiated to render a result set or part of a result
set. `View` subclasses may be parametrized using the following class
attributes:
* `templatable` indicates if the view may be embedded in a main
template or if it has to be rendered standalone (i.e. pure XML views
must not be embedded in the main template of HTML pages)
* if the view is not templatable, it should set the `content_type`
class attribute to the correct MIME type (text/xhtml being the
default)
* the `category` attribute may be used in the interface to regroup
related view kinds together
A view writes to its output stream thanks to its attribute `w` (the
append method of an `UStreamIO`, except for binary views).
At instantiation time, the standard `_cw` and `cw_rset` attributes are
added and the `w` attribute will be set at rendering time.
.. autoclass:: cubicweb.view.View
The basic interface for views is as follows (remember that the result
set has a tabular structure with rows and columns, hence cells):
......@@ -88,12 +65,13 @@ set has a tabular structure with rows and columns, hence cells):
Other basic view classes
````````````````````````
Here are some of the subclasses of `View` defined in `cubicweb.view`
Here are some of the subclasses of :ref:`View` defined in :ref:`cubicweb.view`
that are more concrete as they relate to data rendering within the application:
* `EntityView`, view applying to lines or cell containing an entity (e.g. an eid)
* `StartupView`, start view that does not require a result set to apply to
* `AnyRsetView`, view applicable to any result set
.. autoclass:: cubicweb.view.EntityView
.. autoclass:: cubicweb.view.StartupView
.. autoclass:: cubicweb.view.EntityStartupView
.. autoclass:: cubicweb.view.AnyRsetView
Examples of views class
```````````````````````
......
......@@ -90,19 +90,30 @@ STRICT_DOCTYPE_NOEXT = u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN
# base view object ############################################################
class View(AppObject):
"""abstract view class, used as base for every renderable object such
as views, templates, some components...web
A view is instantiated to render a [part of a] result set. View
subclasses may be parametred using the following class attributes:
* `templatable` indicates if the view may be embeded in a main
template or if it has to be rendered standalone (i.e. XML for
instance)
* if the view is not templatable, it should set the `content_type` class
attribute to the correct MIME type (text/xhtml by default)
* the `category` attribute may be used in the interface to regroup related
objects together
"""This class is an abstraction of a view class, used as a base class for
every renderable object such as views, templates and other user interface
components.
A `View` is instantiated to render a result set or part of a result
set. `View` subclasses may be parametrized using the following class
attributes:
:py:attr:`templatable` indicates if the view may be embedded in a main
template or if it has to be rendered standalone (i.e. pure XML views must
not be embedded in the main template of HTML pages)
:py:attr:`content_type` if the view is not templatable, it should set the
`content_type` class attribute to the correct MIME type (text/xhtml being
the default)
:py:attr:`category` this attribute may be used in the interface to regroup
related objects (view kinds) together
:py:attr:`paginable`
:py:attr:`binary`
A view writes to its output stream thanks to its attribute `w` (the
append method of an `UStreamIO`, except for binary views).
At instantiation time, the standard `_cw`, and `cw_rset` attributes are
added and the `w` attribute will be set at rendering time to a write
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment