doc/book/en/devweb/views/views.rst
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Fri, 23 Apr 2010 17:31:46 +0200
branchstable
changeset 5394 105011657405
parent 5312 doc/book/en/development/devweb/views/views.rst@d2dbba898a96
child 6152 6824f8b61098
permissions -rw-r--r--
[doc/book] move devweb up from development, turn development into devrepo (much better structure)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2544
282261b26774 [doc] fixed some dangling internal links
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
     1
282261b26774 [doc] fixed some dangling internal links
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
     2
.. _Views:
282261b26774 [doc] fixed some dangling internal links
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
     3
5269
2e5bc78d05f3 [doc/book] missing .svg files, refresh .pngs, fixlets
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5266
diff changeset
     4
Principles
2e5bc78d05f3 [doc/book] missing .svg files, refresh .pngs, fixlets
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5266
diff changeset
     5
----------
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     6
5269
2e5bc78d05f3 [doc/book] missing .svg files, refresh .pngs, fixlets
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5266
diff changeset
     7
We'll start with a description of the interface providing a basic
2e5bc78d05f3 [doc/book] missing .svg files, refresh .pngs, fixlets
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5266
diff changeset
     8
understanding of the available classes and methods, then detail the
2e5bc78d05f3 [doc/book] missing .svg files, refresh .pngs, fixlets
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5266
diff changeset
     9
view selection principle.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    10
5262
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    11
A `View` is an object responsible for the rendering of data from the
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    12
model into an end-user consummable form. They typically churn out an
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    13
XHTML stream, but there are views concerned with email other non-html
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    14
outputs.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    15
5284
ad922b7449aa [doc/book] rework the templates chapter (wipe out horrible example, talk more about structure)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5269
diff changeset
    16
.. _views_base_class:
ad922b7449aa [doc/book] rework the templates chapter (wipe out horrible example, talk more about structure)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5269
diff changeset
    17
5312
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    18
Discovering possible views
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    19
~~~~~~~~~~~~~~~~~~~~~~~~~~
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    20
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    21
It is possible to configure the web user interface to have a left box
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    22
showing all the views than can be applied to the current result set.
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    23
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    24
To enable this, click on your login at the top right corner. Chose
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    25
"user preferences", then "boxes", then "possible views box" and check
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    26
"visible = yes" before validating your changes.
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    27
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    28
The views listed there we either not selected because of a lower
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    29
score, or they were deliberately excluded by the main template logic.
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    30
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    31
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    32
Basic class for views
4437
21f2e01fdd6a update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3293
diff changeset
    33
~~~~~~~~~~~~~~~~~~~~~
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    34
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    35
Class `View` (`cubicweb.view`)
5262
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    36
```````````````````````````````
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    37
5312
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    38
This class is an abstraction of a view class, used as a base class for
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    39
every renderable object such as views, templates and other user
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5284
diff changeset
    40
interface components.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    41
5262
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    42
A `View` is instantiated to render a result set or part of a result
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    43
set. `View` subclasses may be parametrized using the following class
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    44
attributes:
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    45
5222
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    46
* `templatable` indicates if the view may be embedded in a main
5262
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    47
  template or if it has to be rendered standalone (i.e. pure XML views
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    48
  must not be embedded in the main template of HTML pages)
5222
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    49
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    50
* if the view is not templatable, it should set the `content_type`
5262
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    51
  class attribute to the correct MIME type (text/xhtml being the
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    52
  default)
5222
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    53
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    54
* the `category` attribute may be used in the interface to regroup
5262
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    55
  related view kinds together
5222
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    56
5262
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    57
A view writes to its output stream thanks to its attribute `w` (the
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    58
append method of an `UStreamIO`, except for binary views).
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    59
4442
7bc0e4ed4109 fix stupid sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4437
diff changeset
    60
At instantiation time, the standard `_cw` and `cw_rset` attributes are
3258
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    61
added and the `w` attribute will be set at rendering time.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    62
5262
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    63
The basic interface for views is as follows (remember that the result
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    64
set has a tabular structure with rows and columns, hence cells):
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    65
3258
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    66
* `render(**context)`, render the view by calling `call` or
5262
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
    67
  `cell_call` depending on the context
3258
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    68
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    69
* `call(**kwargs)`, call the view for a complete result set or null
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    70
  (the default implementation calls `cell_call()` on each cell of the
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    71
  result set)
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    72
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    73
* `cell_call(row, col, **kwargs)`, call the view for a given cell of a
5222
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    74
  result set (`row` and `col` being integers used to access the cell)
3258
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    75
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    76
* `url()`, returns the URL enabling us to get the view with the current
2172
cf8f9180e63e delete-trailing-whitespace
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1714
diff changeset
    77
  result set
3258
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    78
5222
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    79
* `wview(__vid, rset, __fallback_vid=None, **kwargs)`, call the view of
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    80
  identifier `__vid` on the given result set. It is possible to give a
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    81
  fallback view identifier that will be used if the requested view is
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    82
  not applicable to the result set.
2172
cf8f9180e63e delete-trailing-whitespace
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1714
diff changeset
    83
5222
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    84
* `html_headers()`, returns a list of HTML headers to be set by the
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4936
diff changeset
    85
  main template
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    86
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    87
* `page_title()`, returns the title to use in the HTML header `title`
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    88
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    89
Other basic view classes
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    90
````````````````````````
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    91
Here are some of the subclasses of `View` defined in `cubicweb.common.view`
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    92
that are more concrete as they relate to data rendering within the application:
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    93
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    94
* `EntityView`, view applying to lines or cell containing an entity (e.g. an eid)
4446
a413fac5ff5e damn me, more stupid sed fix...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4445
diff changeset
    95
* `StartupView`, start view that does not require a result set to apply to
3258
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    96
* `AnyRsetView`, view applicable to any result set
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    97
2172
cf8f9180e63e delete-trailing-whitespace
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1714
diff changeset
    98
Examples of views class
5269
2e5bc78d05f3 [doc/book] missing .svg files, refresh .pngs, fixlets
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5266
diff changeset
    99
```````````````````````
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   100
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   101
- Using `templatable`, `content_type` and HTTP cache configuration
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   102
2544
282261b26774 [doc] fixed some dangling internal links
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   103
.. sourcecode:: python
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   104
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   105
    class RSSView(XMLView):
4751
1a9d2c3c7f0c [book] more id -> __regid__
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4446
diff changeset
   106
        __regid__ = 'rss'
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   107
        title = _('rss')
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   108
        templatable = False
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   109
        content_type = 'text/xml'
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   110
        http_cache_manager = MaxAgeHTTPCacheManager
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   111
        cache_max_age = 60*60*2 # stay in http cache for 2 hours by default
2172
cf8f9180e63e delete-trailing-whitespace
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1714
diff changeset
   112
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   113
5262
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
   114
- Using a custom selector
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   115
2544
282261b26774 [doc] fixed some dangling internal links
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   116
.. sourcecode:: python
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   117
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   118
    class SearchForAssociationView(EntityView):
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   119
        """view called by the edition view when the user asks
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   120
        to search for something to link to the edited eid
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   121
        """
4751
1a9d2c3c7f0c [book] more id -> __regid__
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 4446
diff changeset
   122
        __regid__ = 'search-associate'
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   123
        title = _('search for association')
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   124
        __select__ = one_line_rset() & match_search_state('linksearch') & implements('Any')
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   125
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   126
4437
21f2e01fdd6a update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3293
diff changeset
   127
XML views, binaries views...
21f2e01fdd6a update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3293
diff changeset
   128
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2544
282261b26774 [doc] fixed some dangling internal links
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   129
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   130
For views generating other formats than HTML (an image generated dynamically
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   131
for example), and which can not simply be included in the HTML page generated
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   132
by the main template (see above), you have to:
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   133
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   134
* set the attribute `templatable` of the class to `False`
5262
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
   135
* set, through the attribute `content_type` of the class, the MIME
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
   136
  type generated by the view to `application/octet-stream` or any
ebd90d2a5639 [doc/book] move a big chunk of primary view customisation example in the primary view chapter
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5222
diff changeset
   137
  relevant and more specialised mime type
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   138
2172
cf8f9180e63e delete-trailing-whitespace
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1714
diff changeset
   139
For views dedicated to binary content creation (like dynamically generated
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   140
images), we have to set the attribute `binary` of the class to `True` (which
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   141
implies that `templatable == False`, so that the attribute `w` of the view could be
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
   142
replaced by a binary flow instead of unicode).