[Cubicweb] customize rendering of a specific attribute in cw

Sylvain Thénault sylvain.thenault at logilab.fr
Fri May 25 10:37:29 CEST 2012

On 25 mai 09:29, aurélien campéas wrote:
> On entity classes, there is a printable_value method that can also be
> customized (on Airport in your case) .
> This should be invoked (automatically) by the 'attribute' view (in
> views/primary.py).

This is an option, though I would rather suggest the following:

class DegreeAttributeView(EntityView):
    __regid__ = 'degree'
    __select__ = is_instance('Airport') & match_kwargs('rtype')

    def entity_call(self, entity, rtype, **kwargs):

_pvdc = uicfg.primaryview_display_ctrl
_pvdc.tag_attribute(('Airport', 'coordinate'), {'vid': 'degree'})

This should be enough for most places, but not all like printable_value.
If this is not enough to you, then go for Aurelien'suggestion (but think
to test edition :p.

Sylvain Thénault, LOGILAB, Paris ( - Toulouse (
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