doc/devmanual_fr/chap_fondements_cubicweb.txt
author Sandrine Ribeau <sandrine.ribeau@logilab.fr>
Tue, 11 Nov 2008 14:27:19 -0800
changeset 22 50f20cf0f440
parent 20 dfddcbef6684
child 36 f6bcad5c6dfe
permissions -rw-r--r--
Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework. Replaced original content of mise_en_place_environemment that was by mistake erased and replaced with chap_migration 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
Fondements `CubicWeb`
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
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     6
Architecture globale
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
.. image:: archi_globale.png
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
**Note**: en pratique la partie cliente et la partie serveur sont
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    11
généralement intégrées dans le même processus et communiquent donc
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    12
directement, sans nécessiter des appels distants via Pyro. Il est
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    13
cependant important de retenir que ces deux parties sont disjointes
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    14
et qu'il est même possible d'en exécuter plusieurs exemplaires dans
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    15
des processus distincts pour répartir la charge globale d'un site
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    16
sur une ou plusieurs machines.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    17
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    18
Concepts et vocabulaire
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    19
-----------------------
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    20
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    21
*schéma*
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    22
  le schéma définit le modèle de données d'une application sous forme
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    23
  d'entités et de relations, grâce à la biblithèque `yams`_. C'est
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    24
  l'élément central d'une application. Il est initialement défini sur
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    25
  le système de fichiers et est stocké dans la base de données lors de
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    26
  la création d'une instance. `CubicWeb` fournit un certain nombres de
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    27
  types d'entités inclus systématiquement car nécessaire au noyau
20
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    28
  `CubicWeb` et une librairie de cubes devant être inclus
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    29
  explicitement le cas échéant.
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
*type d'entité* 
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    32
  une entité est un ensemble d'attributs ; l'attribut de
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    33
  base de toute entité, qui est sa clef, est l'eid
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
*type de relation*
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    36
  les entités sont liées entre elles par des relations. Dans cubicweb les
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    37
  relations sont binaires : par convention on nomme le premier terme
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    38
  d'une relation son 'sujet' et le second son 'objet'.
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
*type d'entité final*
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    41
  les types finaux correspondent aux types de bases comme les chaînes
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    42
  de caractères, les nombres entiers... Une propriété de ces types est
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    43
  qu'ils ne peuvent être utilisés qu'uniquement comme objet d'une
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    44
  relation. Les attributs d'une entité (non finale) sont des entités
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    45
  (finales).
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    46
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    47
*type de relation finale*
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    48
  une relation est dite finale si son objet est un type final. Cela revient à
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    49
  un attribut d'une entité.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    50
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    51
*entrepôt*
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    52
  ou *repository*, c'est la partie serveur RQL de `CubicWeb`. Attention à ne pas
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    53
  confondre avec un entrepôt mercurial ou encore un entrepôt debian.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    54
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    55
*source*
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    56
  une source de données est un conteneur de données quelquonque (SGBD, annuaire
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    57
  LDAP...) intégré par l'entrepôt `CubicWeb`. Un entrepôt possède au moins une source
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    58
  dite "system" contenant le schéma de l'application, l'index plein-texte et
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    59
  d'autres informations vitales au système.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    60
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    61
*configuration*
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    62
  il est possible de créer différentes configurations pour une instance :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    63
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    64
  - ``repository`` : entrepôt uniquement, accessible pour les clients via Pyro
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    65
  - ``twisted`` : interface web uniquement, communiquant avec un entrepôt via Pyro
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    66
  - ``all-in-one`` : interface web et entrepôt dans un seul processus. L'entrepôt
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    67
     peut ou non être accessible via Pyro
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    68
20
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    69
*cube*
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    70
  un cube est un modèle regroupant un ou plusieurs types de données et/ou
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    71
  des vues afin de fournir une fonctionalité précise, ou une application `CubicWeb`
20
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    72
  complète utilisant éventuellement d'autres cube. Les différents
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    73
  cubes disponibles sur une machine sont installés dans
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    74
  `/path/to/forest/cubicweb/cubes`
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    75
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    76
*instance*
20
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    77
  une instance est une installation spécifique d'un template. Sont regroupes
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    78
  dans une instance tous les fichiers de configurations necessaires au bon
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    79
  fonctionnement de votre application web. Elle referrera au(x) cube(s) sur 
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    80
  le(s)quel(s) votre application se base.
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    81
  Par exemple intranet/jpl et logilab.org sont deux instances du cube jpl que
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    82
  nous avons developpes en interne. 
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    83
  Les instances sont définies dans le répertoire `~/etc/cubicweb.d`.
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    84
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    85
*application*
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    86
  le mot application est utilisé parfois pour parler d'une instance et parfois
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    87
  d'un composant, en fonction du contexte... Mieux vaut donc éviter de
20
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
    88
  l'utiliser et utiliser plutôt *cube* et *instance*.
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    89
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    90
*result set*
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    91
  objet encaspulant les résultats d'une requête RQL et des informations sur
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    92
  cette requête.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    93
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    94
*Pyro*
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    95
  `Python Remote Object`_, système d'objets distribués pur Python similaire à
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    96
  Java's RMI (Remote Method Invocation), pouvant être utilisé pour la
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    97
  communication entre la partie web du framework et l'entrepôt RQL.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    98
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    99
.. _`Python Remote Object`: http://pyro.sourceforge.net/
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   100
.. _`yams`: http://www.logilab.org/project/name/yams/
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   101
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   102
22
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   103
Moteur `CubicWeb`
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   104
-----------------
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   105
Le moteur web de cubicweb consiste en quelques classes gérant un ensemble d'objets
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   106
chargés dynamiquement au lancement de cubicweb. Ce sont ces objets dynamiques, issus
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   107
du modèle ou de la librairie, qui construisent le site web final. Les différents
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   108
composants dynamiques sont par exemple : 
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   109
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   110
* coté client et serveur
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   111
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   112
 - les définitions d'entités, contenant la logique permettant la manipulation des
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   113
   données de l'application
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   114
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   115
* coté client
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   116
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   117
  - les *vues* , ou encore plus spécifiquement 
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   118
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   119
    - les boites
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   120
    - l'en-tête et le pied de page
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   121
    - les formulaires
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   122
    - les gabarits de pages
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   123
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   124
  - les *actions*
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   125
  - les *controleurs*
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   126
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   127
* coté serveur
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   128
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   129
  - les crochets de notification
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   130
  - les vues de notification
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   131
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   132
Les différents composants du moteur sont :
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   133
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   134
* un frontal web (seul twisted disponible pour le moment), transparent du point
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   135
  de vue des objets dynamiques
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   136
* un objet encapsulant la configuration
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   137
* un `vregistry` (`cubicweb.cwvreg`) contenant les objets chargés dynamiquements
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   138
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   139
Détail de la procédure d'enregistrement
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   140
---------------------------------------
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   141
Au démarage le `vregistry` ou base de registres inspecte un certain nombre de
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   142
répertoires à la recherche de définition de classes "compatible". Après une
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   143
procédure d'enregistrement les objets sont affectés dans différents registres
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   144
afin d'être ensuite séléctionné dynamiquement pendant le fonctionnement de
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   145
l'application.
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   146
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   147
La classe de base de tout ces objets est la classe `AppRsetObject` (module
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   148
`cubicweb.common.appobject`). 
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   149
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   150
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   151
API Python/RQL
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   152
--------------
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   153
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   154
Inspiré de la db-api standard, avec un object Connection possédant les méthodes
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   155
cursor, rollback et commit principalement. La méthode importante est la méthode
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   156
`execute` du curseur :
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   157
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   158
`execute(rqlstring, args=None, eid_key=None, build_descr=True)`
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   159
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   160
:rqlstring: la requête rql à éxécuter (unicode)
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   161
:args: si la requête contient des substitutions, un dictionnaire contenant les
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   162
       valeurs à utiliser
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   163
:eid_key: 
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   164
   un détail d'implémentation du cache de requêtes RQL fait que si une substitution est
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   165
   utilisée pour introduire un eid *levant des ambiguités dans la résolution de
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   166
   type de la requête*, il faut spécifier par cet argument la clé correspondante
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   167
   dans le dictionnaire
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   168
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   169
C'est l'objet Connection qui possède les méthodes classiques `commit` et
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   170
`rollback`. Vous ne *devriez jamais avoir à les utiliser* lors du développement
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   171
d'interface web sur la base du framework CubicWeb étant donné que la fin de la
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   172
transaction est déterminée par celui-ci en fonction du succès d'éxécution de la
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   173
requête. 
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   174
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   175
NOTE : lors de l'éxécution de requêtes de modification (SET,INSERT,DELETE), si une
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   176
requête génère une erreur liée à la sécurité, un rollback est systématiquement
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   177
effectuée sur la transaction courante.
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   178
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   179
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   180
La classe `Request` (`cubicweb.web`)
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   181
------------------------------------
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   182
Une instance de requête est créée lorsque une requête HTTP est transmise au
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   183
serveur web. Elle contient des informations telles que les paramètres de
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   184
formulaires, l'utilisateur connecté, etc. 
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   185
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   186
**De manière plus générale une requête représente une demande d'un utilisateur,
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   187
que se soit par HTTP ou non (on parle également de requête rql coté serveur par
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   188
exemple)**
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   189
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   190
Une instance de la classe `Request` possède les attributs :
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   191
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   192
* `user`, instance de`cubicweb.common.utils.User` correspondant à l'utilisateur
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   193
  connecté 
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   194
* `form`, dictionaire contenant les valeurs de formulaire web
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   195
* `encoding`, l'encodage de caractère à utiliser dans la réponse
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   196
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   197
Mais encore :
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   198
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   199
:Gestion des données de session:        
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   200
  * `session_data()`, retourne un dictionaire contenant l'intégralité des
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   201
    données de la session
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   202
  * `get_session_data(key, default=None)`, retourne la valeur associée à
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   203
    la clé ou la valeur `default` si la clé n'est pas définie
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   204
  * `set_session_data(key, value)`, associe une valeur à une clé
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   205
  * `del_session_data(key)`,  supprime la valeur associé à une clé
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   206
    
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   207
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   208
:Gestion de cookie:
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   209
  * `get_cookie()`, retourne un dictionnaire contenant la valeur de l'entête
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   210
    HTTP 'Cookie'
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   211
  * `set_cookie(cookie, key, maxage=300)`, ajoute un en-tête HTTP `Set-Cookie`,
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   212
    avec une durée de vie 5 minutes par défault (`maxage` = None donne un cooke
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   213
    *de session"* expirant quand l'utilisateur ferme son navigateur
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   214
  * `remove_cookie(cookie, key)`, fait expirer une valeur
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   215
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   216
:Gestion d'URL:
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   217
  * `url()`, retourne l'url complète de la requête HTTP
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   218
  * `base_url()`, retourne l'url de la racine de l'application
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   219
  * `relative_path()`, retourne chemin relatif de la requête
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   220
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   221
:Et encore...:
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   222
  * `set_content_type(content_type, filename=None)`, place l'en-tête HTTP
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   223
    'Content-Type'
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   224
  * `get_header(header)`, retourne la valeur associé à un en-tête HTTP
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   225
    arbitraire de la requête
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   226
  * `set_header(header, value)`, ajoute un en-tête HTTP arbitraire dans la
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   227
    réponse 
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   228
  * `cursor()` retourne un curseur RQL sur la session
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   229
  * `execute(*args, **kwargs)`, raccourci vers .cursor().execute()
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   230
  * `property_value(key)`, gestion des propriétés (`EProperty`)
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   231
  * le dictionaire `data` pour stocker des données pour partager de
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   232
    l'information entre les composants *durant l'éxécution de la requête*.
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   233
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   234
A noter que cette classe est en réalité abstraite et qu'une implémentation
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   235
concrète sera fournie par le *frontend* web utilisé (en l'occurent *twisted*
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   236
aujourd'hui). Enfin pour les vues ou autres qui sont éxécutés coté serveur,
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   237
la majeure partie de l'interface de `Request` est définie sur la session
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   238
associée au client. 
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   239
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   240
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   241
La classe `AppObject`
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   242
---------------------
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   243
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   244
En général :
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   245
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   246
* on n'hérite pas directement des cette classe mais plutôt d'une classe
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   247
  plus spécifique comme par exemple `AnyEntity`, `EntityView`, `AnyRsetView`,
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   248
  `Action`...
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   249
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   250
* pour être enregistrable, un classe fille doit définir son registre (attribut
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   251
  `__registry__`) et son identifiant (attribut `id`). Généralement on n'a pas à
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   252
  s'occuper du registre, uniquement de l'identifiant `id` :) 
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   253
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   254
On trouve un certain nombre d'attributs et de méthodes définis dans cette classe
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   255
et donc commune à tous les objets de l'application :
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   256
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   257
A l'enregistrement, les attributs suivants sont ajoutés dynamiquement aux
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   258
*classes* filles:
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   259
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   260
* `vreg`, le `vregistry` de l'application
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   261
* `schema`, le schéma de l'application
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   262
* `config`, la configuration de l'application
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   263
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   264
On trouve également sur les instances les attributs :
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   265
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   266
* `req`, instance de `Request`
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   267
* `rset`, le "result set" associé à l'objet le cas échéant
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   268
* `cursor`, curseur rql sur la session
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   269
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   270
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   271
:Gestion d'URL:
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   272
  * `build_url(method=None, **kwargs)`, retourne une URL absolue construites à
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   273
    partir des arguments donnés. Le *controleur* devant gérer la réponse
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   274
    peut-être spécifié via l'argument spécial `method` (le branchement est
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   275
    théoriquement bien effectué automatiquement :).
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   276
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   277
  * `datadir_url()`, retourne l'url du répertoire de données de l'application
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   278
    (contenant les fichiers statiques tels que les images, css, js...)
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   279
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   280
  * `base_url()`, raccourci sur `req.base_url()`
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   281
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   282
  * `url_quote(value)`, version *unicode safe* de de la fonction `urllib.quote`
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   283
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   284
:Manipulation de données:
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   285
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   286
  * `etype_rset(etype, size=1)`, raccourci vers `vreg.etype_rset()`
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   287
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   288
  * `eid_rset(eid, rql=None, descr=True)`, retourne un objet result set pour
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   289
    l'eid donné
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   290
  * `entity(row, col=0)`, retourne l'entité correspondant à la position données
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   291
    du "result set" associé à l'objet
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   292
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   293
  * `complete_entity(row, col=0, skip_bytes=True)`, équivalent à `entity` mais
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   294
    appelle également la méthode `complete()` sur l'entité avant de la retourner
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   295
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   296
:Formattage de données:
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   297
  * `format_date(date, date_format=None, time=False)`
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   298
  * `format_time(time)`,
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   299
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   300
:Et encore...:
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   301
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   302
  * `external_resource(rid, default=_MARKER)`, accède à une valeur définie dans
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   303
    le fichier de configuration `external_resource`
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   304
    
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   305
  * `tal_render(template, variables)`, 
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   306
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   307
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   308
**NOTE IMPORTANTE**
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   309
Lorsqu'on hérite d'`AppObject` (même indirectement), il faut **toujours**
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   310
utiliser **super()** pour récupérer les méthodes et attributs des classes
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   311
parentes, et pas passer par l'identifiant de classe parente directement.
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   312
(sous peine de tomber sur des bugs bizarres lors du rechargement automatique
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   313
des vues). Par exemple, plutôt que d'écrire::
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   314
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   315
      class Truc(PrimaryView):
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   316
          def f(self, arg1):
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   317
              PrimaryView.f(self, arg1)
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   318
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   319
Il faut écrire::
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   320
      
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   321
      class Truc(PrimaryView):
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   322
          def f(self, arg1):
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   323
              super(Truc, self).f(arg1)
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   324
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   325
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   326
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   327
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   328
50f20cf0f440 Merged chap_fondements_cubicweb and chap_bases_framework_cubicweb as they were both describing differents aspects of CubicWeb framework.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 20
diff changeset
   329
20
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
   330
Structure standard d'un cube
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
   331
----------------------------
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   332
20
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
   333
Un cube complexe est structuré selon le modèle suivant :
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   334
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   335
::
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   336
  
20
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
   337
  moncube/
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   338
  |
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   339
  |-- schema.py
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   340
  |
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   341
  |-- entities/
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   342
  |
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   343
  |-- sobjects/
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   344
  |
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   345
  |-- views/
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   346
  |
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   347
  |-- test/
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   348
  |
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   349
  |-- i18n/
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   350
  |
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   351
  |-- data/
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   352
  |
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   353
  |-- migration/
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   354
  | |- postcreate.py
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   355
  | \- depends.map
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   356
  |
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   357
  |-- debian/
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   358
  |
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   359
  \-- __pkginfo__.py
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   360
    
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   361
On peut utiliser de simple module python plutôt que des répertoires (packages),
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   362
par ex.:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   363
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   364
::
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   365
  
20
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
   366
  moncube/
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   367
  |
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   368
  |-- entities.py
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   369
  |-- hooks.py
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   370
  \-- views.py
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   371
    
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   372
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   373
où :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   374
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   375
* ``schema`` contient la définition du schéma (coté serveur uniquement)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   376
* ``entities`` contient les définitions d'entités (coté serveur et interface web)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   377
* ``sobjects`` contient les crochets et/ou vues de notification (coté serveur
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   378
  uniquement) 
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   379
* ``views`` contient les différents composants de l'interface web (coté interface
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   380
  web uniquement)  
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   381
* ``test`` contient les tests spécifiques à l'application (non installé)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   382
* ``i18n`` contient les catalogues de messages pour les langues supportées (coté
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   383
  serveur et interface web) 
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   384
* ``data`` contient des fichiers de données arbitraires servis statiquement
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   385
  (images, css, fichiers javascripts)... (coté interface web uniquement)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   386
* ``migration`` contient le fichier d'initialisation de nouvelles instances
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   387
  (``postcreate.py``) et générallement un fichier donnant les dépendances `CubicWeb` du
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   388
  composant en fonction de la version de celui-ci (``depends.map``)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   389
* ``debian`` contient les fichiers contrôlant le packaging debian (vous y
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   390
  trouverez les fichiers classiques ``control``, ``rules``, ``changelog``... (non
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   391
  installé) 
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   392
* le fichier ``__pkginfo__.py`` donne un certain nombre de méta-données sur le
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   393
  composant, notamment le nom de la distribution et la version courante (coté
20
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
   394
  serveur et interface web) ou encore les sous-cubes utilisés par ce
dfddcbef6684 Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 0
diff changeset
   395
  cube. 
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   396
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   397
Le strict minimum étant :
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   398
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   399
* le fichier ``__pkginfo__.py``
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   400
* la définition du schéma