author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Mon, 16 Nov 2009 14:47:47 +0100 | |
branch | stable |
changeset 3858 | ba96e4607e67 |
parent 1398 | 5fe84a5f7035 |
permissions | -rw-r--r-- |
0 | 1 |
.. -*- coding: utf-8 -*- |
2 |
||
3 |
Fondements `CubicWeb` |
|
4 |
===================== |
|
71
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
5 |
Un peu d'histoire... |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
6 |
-------------------- |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
7 |
|
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
8 |
`CubicWeb` est une plate-forme logicielle de développement d'application web |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
9 |
qui est développée par Logilab_ depuis 2001. |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
10 |
|
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
11 |
|
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
12 |
Entièrement développée en Python, `CubicWeb` publie des données provenant |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
13 |
de plusieurs sources telles que des bases de données SQL, des répertoire |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
14 |
LDAP et des systèmes de gestion de versions tels que subversion. |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
15 |
|
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
16 |
L'interface utilisateur de `CubicWeb` a été spécialement conçue pour laisser |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
17 |
à l'utilisateur final toute latitude pour sélectionner puis présenter les données. |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
18 |
Elle permet d'explorer aisément la base de connaissances et d'afficher les |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
19 |
résultats avec la présentation la mieux adaptée à la tâche en cours. |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
20 |
La flexibilité de cette interface redonne à l'utilisateur le contrôle de |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
21 |
paramètres d'affichage et de présentation qui sont habituellement réservés |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
22 |
aux développeurs. |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
23 |
|
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
24 |
Parmi les applications déjà réalisées, on dénombre un annuaire en ligne pour |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
25 |
le grand public (voir http://www.118000.fr/), un système de gestion d'études |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
26 |
numériques et de simulations pour un bureau d'études, un service de garde |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
27 |
partagée d'enfants (voir http://garde-partagee.atoukontact.fr/), la gestion |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
28 |
du développement de projets logiciels (voir http://www.logilab.org), etc. |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
29 |
|
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
30 |
En 2008, `CubicWeb` a été porté pour un nouveau type de source: le datastore |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
31 |
de GoogleAppEngine_. |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
32 |
|
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
33 |
.. _GoogleAppEngine: http://code.google.com/appengine/ |
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
34 |
|
0 | 35 |
|
36 |
Architecture globale |
|
37 |
-------------------- |
|
53
537ad3e8e461
[doc] moved makefile. corrected paths to images.
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
50
diff
changeset
|
38 |
.. image:: images/archi_globale.png |
0 | 39 |
|
40 |
**Note**: en pratique la partie cliente et la partie serveur sont |
|
41 |
généralement intégrées dans le même processus et communiquent donc |
|
42 |
directement, sans nécessiter des appels distants via Pyro. Il est |
|
43 |
cependant important de retenir que ces deux parties sont disjointes |
|
44 |
et qu'il est même possible d'en exécuter plusieurs exemplaires dans |
|
45 |
des processus distincts pour répartir la charge globale d'un site |
|
46 |
sur une ou plusieurs machines. |
|
47 |
||
48 |
Concepts et vocabulaire |
|
49 |
----------------------- |
|
50 |
||
51 |
*schéma* |
|
52 |
le schéma définit le modèle de données d'une application sous forme |
|
54
e5cd878dc796
Add images folder to share images between book/fr and book/en.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
53
diff
changeset
|
53 |
d'entités et de relations, grâce à la bibliothèque `yams`_. C'est |
0 | 54 |
l'élément central d'une application. Il est initialement défini sur |
55 |
le système de fichiers et est stocké dans la base de données lors de |
|
56 |
la création d'une instance. `CubicWeb` fournit un certain nombres de |
|
57 |
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
|
58 |
`CubicWeb` et une librairie de cubes devant être inclus |
0 | 59 |
explicitement le cas échéant. |
60 |
||
61 |
*type d'entité* |
|
62 |
une entité est un ensemble d'attributs ; l'attribut de |
|
63 |
base de toute entité, qui est sa clef, est l'eid |
|
64 |
||
65 |
*type de relation* |
|
36
f6bcad5c6dfe
various doc fixes
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
22
diff
changeset
|
66 |
les entités sont liées entre elles par des relations. Dans `CubicWeb` |
f6bcad5c6dfe
various doc fixes
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
22
diff
changeset
|
67 |
les relations sont binaires : par convention on nomme le premier terme |
0 | 68 |
d'une relation son 'sujet' et le second son 'objet'. |
69 |
||
70 |
*type d'entité final* |
|
71 |
les types finaux correspondent aux types de bases comme les chaînes |
|
72 |
de caractères, les nombres entiers... Une propriété de ces types est |
|
73 |
qu'ils ne peuvent être utilisés qu'uniquement comme objet d'une |
|
74 |
relation. Les attributs d'une entité (non finale) sont des entités |
|
75 |
(finales). |
|
76 |
||
77 |
*type de relation finale* |
|
78 |
une relation est dite finale si son objet est un type final. Cela revient à |
|
79 |
un attribut d'une entité. |
|
80 |
||
81 |
*entrepôt* |
|
82 |
ou *repository*, c'est la partie serveur RQL de `CubicWeb`. Attention à ne pas |
|
83 |
confondre avec un entrepôt mercurial ou encore un entrepôt debian. |
|
84 |
||
85 |
*source* |
|
86 |
une source de données est un conteneur de données quelquonque (SGBD, annuaire |
|
87 |
LDAP...) intégré par l'entrepôt `CubicWeb`. Un entrepôt possède au moins une source |
|
88 |
dite "system" contenant le schéma de l'application, l'index plein-texte et |
|
89 |
d'autres informations vitales au système. |
|
90 |
||
91 |
*configuration* |
|
92 |
il est possible de créer différentes configurations pour une instance : |
|
93 |
||
94 |
- ``repository`` : entrepôt uniquement, accessible pour les clients via Pyro |
|
95 |
- ``twisted`` : interface web uniquement, communiquant avec un entrepôt via Pyro |
|
96 |
- ``all-in-one`` : interface web et entrepôt dans un seul processus. L'entrepôt |
|
97 |
peut ou non être accessible via Pyro |
|
98 |
||
20
dfddcbef6684
Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
0
diff
changeset
|
99 |
*cube* |
dfddcbef6684
Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
0
diff
changeset
|
100 |
un cube est un modèle regroupant un ou plusieurs types de données et/ou |
0 | 101 |
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
|
102 |
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
|
103 |
cubes disponibles sur une machine sont installés dans |
dfddcbef6684
Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
0
diff
changeset
|
104 |
`/path/to/forest/cubicweb/cubes` |
0 | 105 |
|
106 |
*instance* |
|
71
69a4bf8f5e49
Moved content from tutoriel to introduction and to wrokflow chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
54
diff
changeset
|
107 |
une instance est une installation spécifique d'un cube. Sont regroupes |
20
dfddcbef6684
Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
0
diff
changeset
|
108 |
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
|
109 |
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
|
110 |
le(s)quel(s) votre application se base. |
dfddcbef6684
Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
0
diff
changeset
|
111 |
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
|
112 |
nous avons developpes en interne. |
dfddcbef6684
Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
0
diff
changeset
|
113 |
Les instances sont définies dans le répertoire `~/etc/cubicweb.d`. |
0 | 114 |
|
115 |
*application* |
|
116 |
le mot application est utilisé parfois pour parler d'une instance et parfois |
|
117 |
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
|
118 |
l'utiliser et utiliser plutôt *cube* et *instance*. |
0 | 119 |
|
120 |
*result set* |
|
121 |
objet encaspulant les résultats d'une requête RQL et des informations sur |
|
122 |
cette requête. |
|
123 |
||
124 |
*Pyro* |
|
125 |
`Python Remote Object`_, système d'objets distribués pur Python similaire à |
|
126 |
Java's RMI (Remote Method Invocation), pouvant être utilisé pour la |
|
127 |
communication entre la partie web du framework et l'entrepôt RQL. |
|
128 |
||
129 |
.. _`Python Remote Object`: http://pyro.sourceforge.net/ |
|
130 |
.. _`yams`: http://www.logilab.org/project/name/yams/ |
|
131 |
||
132 |
||
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
|
133 |
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
|
134 |
----------------- |
36
f6bcad5c6dfe
various doc fixes
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
22
diff
changeset
|
135 |
|
f6bcad5c6dfe
various doc fixes
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
22
diff
changeset
|
136 |
Le moteur web de `CubicWeb` consiste en quelques classes gérant un ensemble d'objets |
f6bcad5c6dfe
various doc fixes
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
22
diff
changeset
|
137 |
chargés dynamiquement au lancement de `CubicWeb`. Ce sont ces objets dynamiques, issus |
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
|
138 |
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
|
139 |
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
|
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 |
* 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
|
142 |
|
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 |
- 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
|
144 |
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
|
145 |
|
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 |
* 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
|
147 |
|
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 |
- 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
|
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 |
- 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
|
151 |
- 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
|
152 |
- 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
|
153 |
- 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
|
154 |
|
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 |
- 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
|
156 |
- 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
|
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 |
* 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
|
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 |
- 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
|
161 |
- 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
|
162 |
|
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 |
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
|
164 |
|
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 |
* 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
|
166 |
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
|
167 |
* 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
|
168 |
* 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
|
169 |
|
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 |
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
|
171 |
--------------------------------------- |
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 |
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
|
173 |
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
|
174 |
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
|
175 |
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
|
176 |
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
|
177 |
|
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 |
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
|
179 |
`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
|
180 |
|
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 |
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
|
183 |
-------------- |
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 |
|
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 |
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
|
186 |
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
|
187 |
`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
|
188 |
|
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 |
`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
|
190 |
|
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 |
: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
|
192 |
: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
|
193 |
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
|
194 |
: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
|
195 |
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
|
196 |
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
|
197 |
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
|
198 |
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
|
199 |
|
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 |
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
|
201 |
`rollback`. Vous ne *devriez jamais avoir à les utiliser* lors du développement |
36
f6bcad5c6dfe
various doc fixes
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
22
diff
changeset
|
202 |
d'interface web sur la base du framework `CubicWeb` étant donné que la fin de la |
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
|
203 |
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
|
204 |
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
|
205 |
|
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 |
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
|
207 |
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
|
208 |
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
|
209 |
|
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 |
|
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 |
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
|
212 |
------------------------------------ |
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 |
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
|
214 |
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
|
215 |
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
|
216 |
|
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 |
**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
|
218 |
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
|
219 |
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
|
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 |
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
|
222 |
|
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 |
* `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
|
224 |
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
|
225 |
* `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
|
226 |
* `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
|
227 |
|
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 |
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
|
229 |
|
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 |
: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
|
231 |
* `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
|
232 |
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
|
233 |
* `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
|
234 |
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
|
235 |
* `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
|
236 |
* `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
|
237 |
|
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 |
|
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 |
: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
|
240 |
* `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
|
241 |
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
|
242 |
* `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
|
243 |
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
|
244 |
*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
|
245 |
* `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
|
246 |
|
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 |
: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
|
248 |
* `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
|
249 |
* `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
|
250 |
* `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
|
251 |
|
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 |
: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
|
253 |
* `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
|
254 |
'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
|
255 |
* `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
|
256 |
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
|
257 |
* `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
|
258 |
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
|
259 |
* `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
|
260 |
* `execute(*args, **kwargs)`, raccourci vers .cursor().execute() |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
93
diff
changeset
|
261 |
* `property_value(key)`, gestion des propriétés (`CWProperty`) |
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
|
262 |
* 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
|
263 |
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
|
264 |
|
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 |
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
|
266 |
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
|
267 |
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
|
268 |
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
|
269 |
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
|
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 |
|
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 |
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
|
273 |
--------------------- |
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 |
|
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 |
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
|
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 |
* 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
|
278 |
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
|
279 |
`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
|
280 |
|
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 |
* 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
|
282 |
`__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
|
283 |
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
|
284 |
|
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 |
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
|
286 |
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
|
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 |
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
|
289 |
*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
|
290 |
|
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 |
* `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
|
292 |
* `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
|
293 |
* `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
|
294 |
|
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 |
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
|
296 |
|
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 |
* `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
|
298 |
* `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
|
299 |
* `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
|
300 |
|
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 |
: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
|
303 |
* `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
|
304 |
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
|
305 |
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
|
306 |
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
|
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 |
* `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
|
309 |
(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
|
310 |
|
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 |
* `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
|
312 |
|
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 |
* `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
|
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 |
: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
|
316 |
|
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 |
* `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
|
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 |
* `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
|
320 |
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
|
321 |
* `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
|
322 |
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
|
323 |
|
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 |
* `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
|
325 |
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
|
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 |
: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
|
328 |
* `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
|
329 |
* `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
|
330 |
|
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
|
331 |
: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
|
332 |
|
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
|
333 |
* `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
|
334 |
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
|
335 |
|
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
|
336 |
* `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
|
337 |
|
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
|
338 |
|
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
|
339 |
**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
|
340 |
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
|
341 |
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
|
342 |
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
|
343 |
(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
|
344 |
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
|
345 |
|
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
|
346 |
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
|
347 |
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
|
348 |
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
|
349 |
|
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
|
350 |
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
|
351 |
|
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
|
352 |
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
|
353 |
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
|
354 |
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
|
355 |
|
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
|
356 |
|
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
|
357 |
|
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
|
358 |
|
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
|
359 |
|
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
|
360 |
|
20
dfddcbef6684
Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
0
diff
changeset
|
361 |
Structure standard d'un cube |
dfddcbef6684
Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
0
diff
changeset
|
362 |
---------------------------- |
0 | 363 |
|
20
dfddcbef6684
Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
0
diff
changeset
|
364 |
Un cube complexe est structuré selon le modèle suivant : |
0 | 365 |
|
366 |
:: |
|
367 |
||
20
dfddcbef6684
Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
0
diff
changeset
|
368 |
moncube/ |
0 | 369 |
| |
370 |
|-- schema.py |
|
371 |
| |
|
372 |
|-- entities/ |
|
373 |
| |
|
374 |
|-- sobjects/ |
|
375 |
| |
|
376 |
|-- views/ |
|
377 |
| |
|
378 |
|-- test/ |
|
379 |
| |
|
380 |
|-- i18n/ |
|
381 |
| |
|
382 |
|-- data/ |
|
383 |
| |
|
384 |
|-- migration/ |
|
385 |
| |- postcreate.py |
|
386 |
| \- depends.map |
|
387 |
| |
|
388 |
|-- debian/ |
|
389 |
| |
|
390 |
\-- __pkginfo__.py |
|
391 |
||
392 |
On peut utiliser de simple module python plutôt que des répertoires (packages), |
|
393 |
par ex.: |
|
394 |
||
395 |
:: |
|
396 |
||
20
dfddcbef6684
Add links between sections.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
0
diff
changeset
|
397 |
moncube/ |
0 | 398 |
| |
399 |
|-- entities.py |
|
400 |
|-- hooks.py |
|
401 |
\-- views.py |
|
402 |
||
403 |
||
404 |
où : |
|
405 |
||
406 |
* ``schema`` contient la définition du schéma (coté serveur uniquement) |
|
407 |
* ``entities`` contient les définitions d'entités (coté serveur et interface web) |
|
408 |
* ``sobjects`` contient les crochets et/ou vues de notification (coté serveur |
|
409 |
uniquement) |
|
410 |
* ``views`` contient les différents composants de l'interface web (coté interface |
|
411 |
web uniquement) |
|
412 |
* ``test`` contient les tests spécifiques à l'application (non installé) |
|
413 |
* ``i18n`` contient les catalogues de messages pour les langues supportées (coté |
|
414 |
serveur et interface web) |
|
415 |
* ``data`` contient des fichiers de données arbitraires servis statiquement |
|
416 |
(images, css, fichiers javascripts)... (coté interface web uniquement) |
|
417 |
* ``migration`` contient le fichier d'initialisation de nouvelles instances |
|
418 |
(``postcreate.py``) et générallement un fichier donnant les dépendances `CubicWeb` du |
|
419 |
composant en fonction de la version de celui-ci (``depends.map``) |
|
420 |
* ``debian`` contient les fichiers contrôlant le packaging debian (vous y |
|
421 |
trouverez les fichiers classiques ``control``, ``rules``, ``changelog``... (non |
|
422 |
installé) |
|
423 |
* le fichier ``__pkginfo__.py`` donne un certain nombre de méta-données sur le |
|
424 |
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
|
425 |
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
|
426 |
cube. |
0 | 427 |
|
428 |
Le strict minimum étant : |
|
429 |
||
430 |
* le fichier ``__pkginfo__.py`` |
|
431 |
* la définition du schéma |