[Cubicweb] CtxComponent and selectors

Sylvain Thénault sylvain.thenault at logilab.fr
Tue Oct 2 15:46:46 CEST 2012


On 02 octobre 14:44, Stéphane Bugat wrote:
> Dear Logilab lovers,

Hi Stéphane,

> I have a difficulty to add a CtxComponent to some specific views. I use the 'match_view' selector like this::
> 
> class MessageToolbarComponent(CtxComponent):
>     """display a toolbar of actions for messages and conversations"""
>     __regid__ = 'message_toolbar'
>     __select__ = (
>         CtxComponent.__select__ & match_user_groups('users') &
>         ( is_instance('MessageNotification') | match_view('all_conversations_view') |
>             match_view('conversation_view')))
>     context = 'ctxtoolbar'
> 
>     def render_body(self, w):
>        (...)
> 
> However, the component is only displayed when in the primary view of a MessageNotification instance... and not in the specified views (both views are Entity views). What's wrong with my selector?

Check the primary view implementation : the toolbar is explicitly generated here, so you probably have to 
have similar code in desired view.
-- 
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