view.py
changeset 8425 b86bdc343c18
parent 8216 99ff746e8de8
parent 8419 dd222fcc85d3
child 8666 1dd655788ece
equal deleted inserted replaced
8412:09432a572a44 8425:b86bdc343c18
    88 STRICT_DOCTYPE_NOEXT = u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
    88 STRICT_DOCTYPE_NOEXT = u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
    89 
    89 
    90 # base view object ############################################################
    90 # base view object ############################################################
    91 
    91 
    92 class View(AppObject):
    92 class View(AppObject):
    93     """abstract view class, used as base for every renderable object such
    93     """This class is an abstraction of a view class, used as a base class for
    94     as views, templates, some components...web
    94     every renderable object such as views, templates and other user interface
    95 
    95     components.
    96     A view is instantiated to render a [part of a] result set. View
    96 
    97     subclasses may be parametred using the following class attributes:
    97     A `View` is instantiated to render a result set or part of a result
    98 
    98     set. `View` subclasses may be parametrized using the following class
    99     * `templatable` indicates if the view may be embeded in a main
    99     attributes:
   100       template or if it has to be rendered standalone (i.e. XML for
   100 
   101       instance)
   101     :py:attr:`templatable` indicates if the view may be embedded in a main
   102     * if the view is not templatable, it should set the `content_type` class
   102       template or if it has to be rendered standalone (i.e. pure XML views must
   103       attribute to the correct MIME type (text/xhtml by default)
   103       not be embedded in the main template of HTML pages)
   104     * the `category` attribute may be used in the interface to regroup related
   104     :py:attr:`content_type` if the view is not templatable, it should set the
   105       objects together
   105       `content_type` class attribute to the correct MIME type (text/xhtml being
       
   106       the default)
       
   107     :py:attr:`category` this attribute may be used in the interface to regroup
       
   108       related objects (view kinds) together
       
   109 
       
   110     :py:attr:`paginable`
       
   111 
       
   112     :py:attr:`binary`
       
   113 
       
   114 
       
   115     A view writes to its output stream thanks to its attribute `w` (the
       
   116     append method of an `UStreamIO`, except for binary views).
   106 
   117 
   107     At instantiation time, the standard `_cw`, and `cw_rset` attributes are
   118     At instantiation time, the standard `_cw`, and `cw_rset` attributes are
   108     added and the `w` attribute will be set at rendering time to a write
   119     added and the `w` attribute will be set at rendering time to a write
   109     function to use.
   120     function to use.
   110     """
   121     """