doc/book/fr/chap_visualisation_donnees.txt
author Sandrine Ribeau <sandrine.ribeau@logilab.fr>
Thu, 13 Nov 2008 17:26:30 -0800
changeset 71 69a4bf8f5e49
parent 53 537ad3e8e461
child 82 57f37f7af21b
permissions -rw-r--r--
Moved content from tutoriel to introduction and to wrokflow chapter. Created site configuration chapter. Started translation of tutoriel to integrate content.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     1
.. -*- coding: utf-8 -*-
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     2
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     3
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     4
Définition de vues
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     5
==================
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     6
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     7
Les classes de base des vues
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     8
----------------------------
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     9
26
eaaa848cf401 Cubicweb renaming.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 24
diff changeset
    10
La class `View` (`cubicweb.common.view`)
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    11
````````````````````````````````````````
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    12
Un vue écrit dans son flux de sortie via son attribut `w` (`UStreamIO`).
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    13
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    14
L'interface de base des vues est la suivante :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    15
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    16
* `dispatch(**context)`, appelle ("rend") la vue en appellent `call` ou
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    17
  `cell_call` en fonction des arguments passé
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    18
* `call(**kwargs)`, appelle la vue pour un result set complet ou nul
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    19
* `cell_call(row, col, **kwargs)`, appelle la vue pour une cellule donnée d'un
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    20
  result set
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    21
* `url()`, retourne l'url permettant d'obtenir cette vue avec le result set en
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    22
  cours 
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    23
* `view(__vid, rset, __fallback_vid=None, **kwargs)`, appelle la vue
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    24
  d'identificant `__vid` sur le result set donné. Il est possible de données un
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    25
  identificant de vue de "fallback" qui sera utilisé si la vue demandée n'est
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    26
  pas applicable au result set
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    27
  
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    28
* `wview(__vid, rset, __fallback_vid=None, **kwargs)`, pareil que `view` mais
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    29
  passe automatiquement le flux en argument
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    30
  
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    31
* `html_headers()`, retourne une liste d'en-tête HTML à placer par le template
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    32
  principal 
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    33
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    34
* `page_title()`, retourne le titre à utiliser dans l'en tête HTML `title`
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    35
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    36
* `creator(eid)`, retourne l'eid et le login du créateur de l'entité ayant
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    37
  l'eid passé en argument
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    38
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    39
Autres classes de base :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    40
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    41
* `EntityView`, vue s'appliquant à aux lignes ou cellule contenant une entité
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    42
  (eg un eid)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    43
* `StartupView`, vue de départ n'ayant pas besoin de result set
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    44
* `AnyRsetView`, vue s'appliquant à n'importe quelle result set
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    45
24
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    46
Le mecanisme de selection de vues
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    47
---------------------------------
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    48
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    49
Pour un identifiant de vue donne, plusieurs vues peuvent etre definies.
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    50
`CubicWeb` utilise un selecteur qui permet de calculer un score et d'identifier
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    51
la vue la plus appropriee a appliquer dans le contexte. La librairie du selecteur
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    52
se trouve dans ``cubicweb.common.selector`` et une librairie des methodes utilisees
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    53
pour calculer les scores est dans ``cubicweb.vregistry.vreq``.
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    54
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    55
[FROM-LAX-BOOK]
24
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    56
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    57
Tip: when modifying views, you do not need to restart the local 
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    58
server. Just save the file in your editor and reload the page in your
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    59
browser to see the changes.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    60
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    61
With `LAX`, views are defined by Python classes. A view includes :
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    62
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    63
- an identifier (all objects in `LAX` are entered in a registry
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    64
  and this identifier will be used as a key)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    65
  
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    66
- a filter to select the resulsets it can be applied to
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    67
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    68
`LAX` provides a lot of standard views, for a complete list, you
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    69
will have to read the code in directory ``ginco/web/views/`` (XXX
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    70
improve doc).
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    72
For example, the view named ``primary`` is the one used to display
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    73
a single entity.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    74
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    75
If you want to change the way a ``BlogEntry`` is displayed, just
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    76
override the view ``primary`` in ``BlogDemo/views.py`` ::
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    77
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    78
  01. from ginco.web.views import baseviews
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    79
  02.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    80
  03. class BlogEntryPrimaryView(baseviews.PrimaryView):
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    81
  04.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    82
  05.     accepts = ('BlogEntry',)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    83
  06.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    84
  07.     def cell_call(self, row, col):
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    85
  08.         entity = self.entity(row, col)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    86
  09.         self.w(u'<h1>%s</h1>' % entity.title)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    87
  10.         self.w(u'<p>published on %s in category %s</p>' % \
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    88
  11.                (entity.publish_date.strftime('%Y-%m-%d'), entity.category))
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    89
  12.         self.w(u'<p>%s</p>' % entity.text)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    90
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    91
The above source code defines a new primary view (`line 03`) for
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    92
``BlogEntry`` (`line 05`). 
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    93
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    94
Since views are applied to resultsets and resulsets can be tables of
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    95
data, it is needed to recover the entity from its (row,col)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    96
coordinates (`line 08`). We will get to this in more detail later.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    97
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    98
The view has a ``self.w()`` method that is used to output data. Here `lines
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    99
09-12` output HTML tags and values of the entity's attributes.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   100
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   101
When displaying same blog entry as before, you will notice that the
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   102
page is now looking much nicer.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   103
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   104
.. image:: ../images/lax-book.09-new-view-blogentry.en.png
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   105
   :alt: blog entries now look much nicer
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   106
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   107
Let us now improve the primary view of a blog ::
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   108
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   109
  01. class BlogPrimaryView(baseviews.PrimaryView):
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   110
  02. 
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   111
  03.     accepts = ('Blog',)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   112
  04.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   113
  05.     def cell_call(self, row, col):
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   114
  06.         entity = self.entity(row, col)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   115
  07.         self.w(u'<h1>%s</h1>' % entity.title)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   116
  08.         self.w(u'<p>%s</p>' % entity.description)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   117
  09.         rset = self.req.execute('Any E WHERE E entry_of B, B eid "%s"' % entity.eid)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   118
  10.         self.wview('primary', rset)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   119
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   120
In the above source code, `lines 01-08` are similar to the previous
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   121
view we defined.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   122
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   123
At `line 09`, a simple request in made to build a resultset with all
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   124
the entities linked to the current ``Blog`` entity by the relationship
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   125
``entry_of``. The part of the framework handling the request knows
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   126
about the schema and infer that such entities have to be of the
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   127
``BlogEntry`` kind and retrieves them.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   128
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   129
The request returns a selection of data called a resultset. At 
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   130
`line 10` the view 'primary' is applied to this resultset to output
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   131
HTML. 
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   132
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   133
**This is to be compared to interfaces and protocols in object-oriented
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   134
languages. Applying a given view to all the entities of a resultset only
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   135
requires the availability, for each entity of this resultset, of a
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   136
view with that name that can accepts the entity.**
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   137
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   138
Assuming we added entries to the blog titled `MyLife`, displaying it
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   139
now allows to read its description and all its entries.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   140
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   141
.. image:: ../images/lax-book.10-blog-with-two-entries.en.png
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   142
   :alt: a blog and all its entries
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   143
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   144
**Before we move forward, remember that the selection/view principle is
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   145
at the core of `LAX`. Everywhere in the engine, data is requested
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   146
using the RQL language, then HTML/XML/text/PNG is output by applying a
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   147
view to the resultset returned by the query. That is where most of the
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   148
flexibility comes from.**
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   149
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   150
[WRITE ME]
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   151
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   152
* implementing interfaces, calendar for blog entries
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   153
* show that a calendar view can export data to ical
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   154
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   155
We will implement the ginco.interfaces.ICalendarable interfaces on
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   156
entities.BloEntry and apply the OneMonthCalendar and iCalendar views
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   157
to resultsets like "Any E WHERE E is BlogEntry"
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   158
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   159
* create view "blogentry table" with title, publish_date, category
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   160
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   161
We will show that by default the view that displays 
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   162
"Any E,D,C WHERE E publish_date D, E category C" is the table view.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   163
Of course, the same can be obtained by calling
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   164
self.wview('table',rset)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   165
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   166
* in view blog, select blogentries and apply view "blogentry table"
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   167
* demo ajax by filtering blogentry table on category
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   168
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   169
we did the same with 'primary', but with tables we can turn on filters
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   170
and show that ajax comes for free.
24
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
   171
[FILLME]
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   172
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   173
Les templates ou patron
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   174
-----------------------
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   175
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   176
Les patrons (ou *template*) sont des cas particulier de vue ne dépendant a
26
eaaa848cf401 Cubicweb renaming.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 24
diff changeset
   177
priori pas d'un result set. La classe de base `Template` (`cubicweb.common.view`)
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   178
est une classe dérivée de la classe `View`.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   179
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   180
Pour construire une page HTML, un *template principal* est utilisé. Généralement
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   181
celui possédant l'identifiant 'main' est utilisé (ce n'est pas le cas lors
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   182
d'erreur dans celui-ci ou pour le formulaire de login par exemple). Ce patron
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   183
utilise d'autres patrons en plus des vues dépendants du contenu pour générer la
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   184
page à renvoyer.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   185
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   186
C'est ce template qui est chargé :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   187
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   188
1. d'éxécuter la requête RQL des données à afficher le cas échéant
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   189
2. éventuellement de déterminer la vue à utiliser pour l'afficher si non
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   190
   spécifiée
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   191
3. de composer la page à retourner
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   192
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   193
26
eaaa848cf401 Cubicweb renaming.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 24
diff changeset
   194
Le patron principal par défaut (`cubicweb.web.views.basetemplates.TheMainTemplate`)
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   195
-----------------------------------------------------------------------------------
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   196
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   197
Le template principal par défaut construit la page selon la décomposition
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   198
suivante :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   199
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   200
.. image:: ../images/main_template_layout.png
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   201
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   202
Le rectancle contenant le `view.dispatch()` représente l'emplacement où est
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   203
inséré la vue de contenu à afficher. Les autres représentent des sous-templates
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   204
appelé pour construire la page. Les implémentations par défaut de tout ces
26
eaaa848cf401 Cubicweb renaming.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 24
diff changeset
   205
templates sont dans le module `cubicweb.web.views.basetemplates`. Vous pouvez
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   206
évidemment surcharger l'un des sous-templates pour modifier l'aspect visuel
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   207
d'une partie désirée de la page.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   208
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   209
On peut également contrôler certains comportements du template principal à
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   210
l'aide des paramètres de formulaire suivante :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   211
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   212
* `__notemplate`, si présente (quelque soit la valeur associée), seule la vue de
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   213
  contenu est renvoyée
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   214
* `__force_display`, si présente et contient une valeur non nulle, pas de
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   215
  navigation quelque soit le nombre d'entités à afficher
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   216
* `__method`, si le result set à afficher ne contient qu'une entité et que ce
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   217
  paramètre est spécifié, celui-ci désigne une méthode à appeler sur l'entité
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   218
  en lui donnant en argument le dictionnaire des paramètres de formulaire, avant
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   219
  de reprendre le comportement classique (s'insère entre les étapes 1. et
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   220
  2. décrites ci-dessus)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   221
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   222
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   223
.. include:: sect_stdlib_vues.txt
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   224
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   225
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   226
Vues xml, binaires...
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   227
---------------------
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   228
Pour les vues générants autre que du html  (une image générée dynamiquement par
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   229
exemple), et qui ne peuvent donc généralement pas être incluse dans la page
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   230
HTML générée par le template principal (voir ci-dessus), il faut :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   231
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   232
* placer l'attribut `templatable` de la classe à `False`
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   233
* indiquer via l'attribut `content_type` de la classe le type MIME généré par la
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   234
  vue 'application/octet-stream'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   235
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   236
Pour les vues générants un contenu binaire (une image générée dynamiquement par
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   237
exemple), il faut également placer l'attribut `binary` de la classe à `True` (ce
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   238
qui implique `templatable == False` afin que l'attribut `w` de la vue soit
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   239
remplacé par un flux binaire plutôt que unicode.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   240
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   241
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   242
Quelques trucs (X)HTML à respecter
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   243
----------------------------------
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   244
Certains navigateurs (dont firefox) n'aime pas les `<div>` vides (par vide
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   245
j'entend sans contenu dans la balise, il peut y avoir des attributs), faut
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   246
toujours mettre `<div></div>` même s'il n'y a rien dedans, et non `<div/>`.