32 |
32 |
33 * `folder`, containing the `Folder` entity type, which will be used as |
33 * `folder`, containing the `Folder` entity type, which will be used as |
34 both 'album' and a way to map file system folders. Entities are |
34 both 'album' and a way to map file system folders. Entities are |
35 added to a given folder using the `filed_under` relation. |
35 added to a given folder using the `filed_under` relation. |
36 |
36 |
37 * `file`, containing `File` and `Image` entity types, gallery view, |
37 * `file`, containing `File` entity type, gallery view, and a file system import |
38 and a file system import utility. |
38 utility. |
39 |
39 |
40 * `zone`, containing the `Zone` entity type for hierarchical geographical |
40 * `zone`, containing the `Zone` entity type for hierarchical geographical |
41 zones. Entities (including sub-zones) are added to a given zone using the |
41 zones. Entities (including sub-zones) are added to a given zone using the |
42 `situated_in` relation. |
42 `situated_in` relation. |
43 |
43 |
52 |
52 |
53 Ok, now I'll tell my cube requires all this by editing :file:`cubes/sytweb/__pkginfo__.py`: |
53 Ok, now I'll tell my cube requires all this by editing :file:`cubes/sytweb/__pkginfo__.py`: |
54 |
54 |
55 .. sourcecode:: python |
55 .. sourcecode:: python |
56 |
56 |
57 __depends__ = {'cubicweb': '>= 3.8.0', |
57 __depends__ = {'cubicweb': '>= 3.10.0', |
58 'cubicweb-file': '>= 1.2.0', |
58 'cubicweb-file': '>= 1.9.0', |
59 'cubicweb-folder': '>= 1.1.0', |
59 'cubicweb-folder': '>= 1.1.0', |
60 'cubicweb-person': '>= 1.2.0', |
60 'cubicweb-person': '>= 1.2.0', |
61 'cubicweb-comment': '>= 1.2.0', |
61 'cubicweb-comment': '>= 1.2.0', |
62 'cubicweb-tag': '>= 1.2.0', |
62 'cubicweb-tag': '>= 1.2.0', |
63 'cubicweb-zone': None} |
63 'cubicweb-zone': None} |
69 contains cube's name without the prefix. So the example below would be written |
69 contains cube's name without the prefix. So the example below would be written |
70 as: |
70 as: |
71 |
71 |
72 .. sourcecode:: python |
72 .. sourcecode:: python |
73 |
73 |
74 __depends__ = {'cubicweb': '>= 3.8.0'} |
74 __depends__ = {'cubicweb': '>= 3.10.0'} |
75 __depends_cubes__ = {'file': '>= 1.2.0', |
75 __depends_cubes__ = {'file': '>= 1.9.0', |
76 'folder': '>= 1.1.0', |
76 'folder': '>= 1.1.0', |
77 'person': '>= 1.2.0', |
77 'person': '>= 1.2.0', |
78 'comment': '>= 1.2.0', |
78 'comment': '>= 1.2.0', |
79 'tag': '>= 1.2.0', |
79 'tag': '>= 1.2.0', |
80 'zone': None} |
80 'zone': None} |
|
81 |
|
82 If your cube is packaged for debian, it's a good idea to update the |
|
83 `debian/control` file at the same time, so you won't forget it. |
81 |
84 |
82 |
85 |
83 Step 3: glue everything together in my cube's schema |
86 Step 3: glue everything together in my cube's schema |
84 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
87 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
85 |
88 |
87 |
90 |
88 from yams.buildobjs import RelationDefinition |
91 from yams.buildobjs import RelationDefinition |
89 |
92 |
90 class comments(RelationDefinition): |
93 class comments(RelationDefinition): |
91 subject = 'Comment' |
94 subject = 'Comment' |
92 object = ('File', 'Image') |
95 object = 'File' |
93 cardinality = '1*' |
96 cardinality = '1*' |
94 composite = 'object' |
97 composite = 'object' |
95 |
98 |
96 class tags(RelationDefinition): |
99 class tags(RelationDefinition): |
97 subject = 'Tag' |
100 subject = 'Tag' |
98 object = ('File', 'Image') |
101 object = 'File' |
99 |
102 |
100 class filed_under(RelationDefinition): |
103 class filed_under(RelationDefinition): |
101 subject = ('File', 'Image') |
104 subject = 'File' |
102 object = 'Folder' |
105 object = 'Folder' |
103 |
106 |
104 class situated_in(RelationDefinition): |
107 class situated_in(RelationDefinition): |
105 subject = 'Image' |
108 subject = 'File' |
106 object = 'Zone' |
109 object = 'Zone' |
107 |
110 |
108 class displayed_on(RelationDefinition): |
111 class displayed_on(RelationDefinition): |
109 subject = 'Person' |
112 subject = 'Person' |
110 object = 'Image' |
113 object = 'File' |
111 |
114 |
112 |
115 |
113 This schema: |
116 This schema: |
114 |
117 |
115 * allows to comment and tag on `File` and `Image` entity types by adding the |
118 * allows to comment and tag on `File` entity type by adding the `comments` and |
116 `comments` and `tags` relations. This should be all we've to do for this |
119 `tags` relations. This should be all we've to do for this feature since the |
117 feature since the related cubes provide 'pluggable section' which are |
120 related cubes provide 'pluggable section' which are automatically displayed on |
118 automatically displayed on the primary view of entity types supporting the |
121 the primary view of entity types supporting the relation. |
119 relation. |
|
120 |
122 |
121 * adds a `situated_in` relation definition so that image entities can be |
123 * adds a `situated_in` relation definition so that image entities can be |
122 geolocalized. |
124 geolocalized. |
123 |
125 |
124 * add a new relation `displayed_on` relation telling who can be seen on a |
126 * add a new relation `displayed_on` relation telling who can be seen on a |