author | Nicolas Chauvat <nicolas.chauvat@logilab.fr> |
Sun, 08 Nov 2009 19:34:31 +0100 | |
branch | stable |
changeset 3806 | 6a4191b0eb9a |
parent 2544 | 282261b26774 |
child 4431 | e597e0ca67cd |
permissions | -rw-r--r-- |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
1 |
.. -*- coding: utf-8 -*- |
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
2 |
|
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
3 |
.. _cubes: |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
4 |
|
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
5 |
Cubes |
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
6 |
----- |
108
60faaa480f02
[doc] another step towards dissolving LAX book into CubicWeb book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
81
diff
changeset
|
7 |
|
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
8 |
Standard library |
116
e2303f9b5bfa
[doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
115
diff
changeset
|
9 |
~~~~~~~~~~~~~~~~ |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
10 |
|
280
ce829abf7c29
[doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
268
diff
changeset
|
11 |
A library of standard cubes are available from `CubicWeb Forge`_ |
ce829abf7c29
[doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
268
diff
changeset
|
12 |
Cubes provide entities and views. |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
13 |
|
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
14 |
The available application entities in standard cubes are: |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
15 |
|
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
16 |
* addressbook: PhoneNumber and PostalAddress |
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
17 |
|
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
18 |
* basket: Basket (like a shopping cart) |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
19 |
|
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
20 |
* blog: Blog (a *very* basic blog) |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
21 |
|
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
22 |
* classfolder: Folder (to organize things but grouping them in folders) |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
23 |
|
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
24 |
* classtags: Tag (to tag anything) |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
25 |
|
2280
31269a9b9ec4
[doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2175
diff
changeset
|
26 |
* comment: Comment (to attach comment threads to entities) |
31269a9b9ec4
[doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2175
diff
changeset
|
27 |
|
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
28 |
* file: File (to allow users to upload and store binary or text files) |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
29 |
|
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
30 |
* link: Link (to collect links to web resources) |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
31 |
|
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
32 |
* mailinglist: MailingList (to reference a mailing-list and the URLs |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
33 |
for its archives and its admin interface) |
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
34 |
|
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
35 |
* person: Person (easily mixed with addressbook) |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
36 |
|
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
37 |
* task: Task (something to be done between start and stop date) |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
38 |
|
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
39 |
* zone: Zone (to define places within larger places, for example a |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
40 |
city in a state in a country) |
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
41 |
|
2544
282261b26774
[doc] fixed some dangling internal links
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2533
diff
changeset
|
42 |
.. _`CubicWeb Forge`: http://www.cubicweb.org/project/ |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
43 |
|
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
44 |
Adding comments to BlogDemo |
116
e2303f9b5bfa
[doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
115
diff
changeset
|
45 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
46 |
|
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
47 |
To import a cube in your instance just change the line in the |
280
ce829abf7c29
[doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
268
diff
changeset
|
48 |
``__pkginfo__.py`` file and verify that the cube you are planning |
ce829abf7c29
[doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
268
diff
changeset
|
49 |
to use is listed by the command ``cubicweb-ctl list``. |
ce829abf7c29
[doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
268
diff
changeset
|
50 |
For example:: |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
51 |
|
280
ce829abf7c29
[doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
268
diff
changeset
|
52 |
__use__ = ('comment',) |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
53 |
|
81
f5886815126b
punctuation stuff
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
74
diff
changeset
|
54 |
will make the ``Comment`` entity available in your ``BlogDemo`` |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2280
diff
changeset
|
55 |
cube. |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
56 |
|
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
57 |
Change the schema to add a relationship between ``BlogEntry`` and |
261
20d5eae54d57
[doc] Rename component with cube.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
58 |
``Comment`` and you are done. Since the comment cube defines the |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
59 |
``comments`` relationship, adding the line:: |
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
60 |
|
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
61 |
comments = ObjectRelation('Comment', cardinality='1*', composite='object') |
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
62 |
|
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
63 |
to the definition of a ``BlogEntry`` will be enough. |
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
64 |
|
280
ce829abf7c29
[doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
268
diff
changeset
|
65 |
Synchronize the data model |
ce829abf7c29
[doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
268
diff
changeset
|
66 |
~~~~~~~~~~~~~~~~~~~~~~~~~~ |
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
67 |
|
280
ce829abf7c29
[doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
268
diff
changeset
|
68 |
Once you modified your data model, you need to synchronize the |
2175
16d3c37c5d28
[doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2172
diff
changeset
|
69 |
database with your model. For this purpose, *CubicWeb* provides |
1463
136756fff6fb
[doc] s/usefull/useful/
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
280
diff
changeset
|
70 |
a very useful command ``cubicweb-ctl shell blogdemo`` which |
2533
07a744f64c2e
[doc] #342929: bad migration command in overview
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2476
diff
changeset
|
71 |
launches an interactive shell where you can enter migration |
07a744f64c2e
[doc] #342929: bad migration command in overview
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2476
diff
changeset
|
72 |
commands. (see :ref:`cubicweb-ctl` for more details)) |
07a744f64c2e
[doc] #342929: bad migration command in overview
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2476
diff
changeset
|
73 |
As you added the cube named `comment`, you need to run: |
07a744f64c2e
[doc] #342929: bad migration command in overview
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2476
diff
changeset
|
74 |
|
74
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
75 |
:: |
9a9fe515934d
[doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
76 |
|
2533
07a744f64c2e
[doc] #342929: bad migration command in overview
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2476
diff
changeset
|
77 |
add_cube('comment') |
2172
cf8f9180e63e
delete-trailing-whitespace
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1808
diff
changeset
|
78 |
|
2533
07a744f64c2e
[doc] #342929: bad migration command in overview
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2476
diff
changeset
|
79 |
You can now start your instance and comment your blog entries. |