[Cubicweb] cubes relationship: what does "recommends" mean ?
sylvain.thenault at logilab.fr
Wed Aug 11 08:46:35 CEST 2010
On 10 août 20:07, Alexandre Fayolle wrote:
> I tried to create a blog instance tonight and there seem to be some strange
> stuff occuring with dependencies.
> The blog cube recommends tag and comment.
> If I create an instance using
> cubicweb-ctl create blog myblog
> tag and comment are not in the instance schema.
indeed, recommends are not automatically installed
> If I use
> cubicweb-ctl create blog,tag,comment myblog
> the Tag and Comment entities are in the schema but not linked to BlogEntries.
> So my question boils down to "what does __recommends__ mean in
> __pkginfo__.py?" Who uses this information, and what can I do in a given cube
> which recommends another one ?
Recommends may be seen as a kind of 'weak dependency'. Eg, the most important
effect of recommending a cube is that, if cube A recommends cube B, the cube B
will be loaded before the cube A (same thing happend when A depends on B).
Having this behaviour is sometime desired: on schema creation, you may rely on
something defined in the other's schema; on database creation, on something
created by the other's postcreate, and so on.
Now regarding the recommends of the blog cube: after greping the code, I only
see that there are some views that check for comments and tags related to
a blog entry, using standard 'tags' and 'comments' relation, that's it.
Those relation could be defined in cube's schema.py if Tag and/or Comment
are available, though they are currently not. Some may consider this as
a bug, some may not (if you do, file a ticket :p). Eventually, the recommends
only means here that blog can take advantage of those cubes. It's in this case
purely informative, we could remove it without loosing anything but a (mini)piece
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
CubicWeb, the semantic web framework: http://www.cubicweb.org
More information about the Cubicweb