[Cubicweb] Integrating CubicWeb views into Pyramid (long)

Sylvain Thénault sylvain.thenault at logilab.fr
Tue Aug 26 17:05:06 CEST 2014


On 06 août 12:13, Nicolas Chauvat wrote:
> On Wed, Aug 06, 2014 at 11:31:03AM +0200, Paul Everitt wrote:
> 
> > Surely, when putting the weight on a CubicWeb view, it is based on
> > some policy in the information model. If not, then when would the
> > lower-weighted view ever get used?
> 
> I do not have all the details loaded up in memory, but a first answer
> that comes to mind is the following.
> 
> Let us assume you are building an application by assembling
> components. For example, you include the cube blog and the cube
> comment and you want to be able to comment your blog entries.
> You will have to put in the registry a new primary view for blog
> entries, that displays comments at the bottom.

nop. The default primary contains some slots where extra components can be
plugged. In your example, the 'comment' cube provide a component that will plug
itself there in case the displayed entity support the 'comment' relation.

I think the correct example is rather with generic view. E.g. if we consider the
'primary' view, cubicweb itself provide an automatic view that apply to any
entity types. Let's say it will always have a score of 1. Then the blog cube
provide a dedicated primary view for Blog entities, by having a selector which
will return a score of 2 for Blog entities. So the default primary view will be
selected for any entities but Blog entities, which will use the more specific
views.

When a cube provide views that should replace other one, this should be done at
registration time.

-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42)
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 mailing list