doc/book/fr/05-define-views.fr.txt
author Nicolas Chauvat <nicolas.chauvat@logilab.fr>
Wed, 12 Aug 2009 19:09:32 +0200
changeset 2789 39712da6f397
parent 93 9c919a47e140
permissions -rw-r--r--
R propagate deprecation of AppObject.entity()
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
82
57f37f7af21b Add more explanation on views in introduction.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 71
diff changeset
     3
.. _DefinitionVues:
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     4
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     5
Définition de vues
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
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     8
Les classes de base des vues
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     9
----------------------------
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    10
26
eaaa848cf401 Cubicweb renaming.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 24
diff changeset
    11
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
    12
````````````````````````````````````````
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    13
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
    14
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    15
L'interface de base des vues est la suivante :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    16
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    17
* `dispatch(**context)`, appelle ("rend") la vue en appellent `call` ou
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    18
  `cell_call` en fonction des arguments passé
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    19
* `call(**kwargs)`, appelle la vue pour un result set complet ou nul
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    20
* `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
    21
  result set
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    22
* `url()`, retourne l'url permettant d'obtenir cette vue avec le result set en
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
    23
  cours
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    24
* `view(__vid, rset, __fallback_vid=None, **kwargs)`, appelle la vue
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    25
  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
    26
  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
    27
  pas applicable au result set
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
    28
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    29
* `wview(__vid, rset, __fallback_vid=None, **kwargs)`, pareil que `view` mais
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    30
  passe automatiquement le flux en argument
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
    31
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    32
* `html_headers()`, retourne une liste d'en-tête HTML à placer par le template
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
    33
  principal
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    34
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    35
* `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
    36
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    37
* `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
    38
  l'eid passé en argument
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    39
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    40
Autres classes de base :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    41
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    42
* `EntityView`, vue s'appliquant à aux lignes ou cellule contenant une entité
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    43
  (eg un eid)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    44
* `StartupView`, vue de départ n'ayant pas besoin de result set
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    45
* `AnyRsetView`, vue s'appliquant à n'importe quelle result set
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    46
24
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    47
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
    48
---------------------------------
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    49
b5303abf484a Add a FAQ and started a section on views selector.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    50
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
    51
`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
    52
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
    53
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
    54
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
    55
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    56
[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
    57
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
    58
Tip: when modifying views, you do not need to restart the local
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    59
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
    60
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
    61
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    62
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
    63
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    64
- 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
    65
  and this identifier will be used as a key)
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
    66
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    67
- 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
    68
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    69
`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
    70
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
    71
improve doc).
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    72
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    73
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
    74
a single entity.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    75
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    76
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
    77
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
    78
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    79
  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
    80
  02.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    81
  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
    82
  04.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    83
  05.     accepts = ('BlogEntry',)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    84
  06.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    85
  07.     def cell_call(self, row, col):
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
    86
  08.         entity = self.rset.get_entity(row, col)
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    87
  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
    88
  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
    89
  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
    90
  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
    91
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    92
The above source code defines a new primary view (`line 03`) for
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
    93
``BlogEntry`` (`line 05`).
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    94
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    95
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
    96
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
    97
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
    98
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
    99
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
   100
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
   101
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   102
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
   103
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
   104
90
7fd4ffeb082b [doc] images were renamed and table of content changed
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 82
diff changeset
   105
.. image:: images/lax-book.09-new-view-blogentry.fr.png
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   106
   :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
   107
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   108
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
   109
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   110
  01. class BlogPrimaryView(baseviews.PrimaryView):
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
   111
  02.
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   112
  03.     accepts = ('Blog',)
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   113
  04.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   114
  05.     def cell_call(self, row, col):
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
   115
  06.         entity = self.rset.get_entity(row, col)
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   116
  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
   117
  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
   118
  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
   119
  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
   120
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   121
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
   122
view we defined.
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   123
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   124
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
   125
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
   126
``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
   127
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
   128
``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
   129
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
   130
The request returns a selection of data called a resultset. At
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   131
`line 10` the view 'primary' is applied to this resultset to output
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
   132
HTML.
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   133
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   134
**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
   135
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
   136
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
   137
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
   138
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   139
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
   140
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
   141
90
7fd4ffeb082b [doc] images were renamed and table of content changed
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 82
diff changeset
   142
.. image:: images/lax-book.10-blog-with-two-entries.fr.png
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   143
   :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
   144
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   145
**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
   146
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
   147
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
   148
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
   149
flexibility comes from.**
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   150
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   151
[WRITE ME]
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   152
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   153
* 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
   154
* 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
   155
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   156
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
   157
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
   158
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
   159
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   160
* 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
   161
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
   162
We will show that by default the view that displays
71
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   163
"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
   164
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
   165
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
   166
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   167
* 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
   168
* 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
   169
69a4bf8f5e49 Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 53
diff changeset
   170
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
   171
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
   172
[FILLME]
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   173
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   174
Les templates ou patron
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
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   177
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
   178
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
   179
est une classe dérivée de la classe `View`.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   180
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   181
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
   182
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
   183
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
   184
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
   185
page à renvoyer.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   186
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   187
C'est ce template qui est chargé :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   188
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   189
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
   190
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
   191
   spécifiée
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   192
3. de composer la page à retourner
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   193
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   194
26
eaaa848cf401 Cubicweb renaming.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 24
diff changeset
   195
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
   196
-----------------------------------------------------------------------------------
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   197
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   198
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
   199
suivante :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   200
82
57f37f7af21b Add more explanation on views in introduction.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 71
diff changeset
   201
.. image:: images/main_template_layout.png
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   202
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   203
Le rectancle contenant le `view.dispatch()` représente l'emplacement où est
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   204
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
   205
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
   206
templates sont dans le module `cubicweb.web.views.basetemplates`. Vous pouvez
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   207
évidemment surcharger l'un des sous-templates pour modifier l'aspect visuel
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   208
d'une partie désirée de la page.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   209
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   210
On peut également contrôler certains comportements du template principal à
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   211
l'aide des paramètres de formulaire suivante :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   212
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   213
* `__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
   214
  contenu est renvoyée
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   215
* `__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
   216
  navigation quelque soit le nombre d'entités à afficher
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   217
* `__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
   218
  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
   219
  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
   220
  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
   221
  2. décrites ci-dessus)
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
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 90
diff changeset
   224
.. include:: 05-01-views-stdlib.fr.txt
0
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
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   227
Vues xml, binaires...
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   228
---------------------
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   229
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
   230
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
   231
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
   232
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   233
* placer l'attribut `templatable` de la classe à `False`
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   234
* 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
   235
  vue 'application/octet-stream'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   236
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   237
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
   238
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
   239
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
   240
remplacé par un flux binaire plutôt que unicode.
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
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   243
Quelques trucs (X)HTML à respecter
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   244
----------------------------------
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   245
Certains navigateurs (dont firefox) n'aime pas les `<div>` vides (par vide
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   246
j'entend sans contenu dans la balise, il peut y avoir des attributs), faut
2789
39712da6f397 R propagate deprecation of AppObject.entity()
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 93
diff changeset
   247
toujours mettre `<div></div>` même s'il n'y a rien dedans, et non `<div/>`.