[Cubicweb] annotating divs with rql and vid

Pierre-Yves David pierre-yves.david at logilab.fr
Thu May 24 17:23:15 CEST 2012


On Thu, May 24, 2012 at 05:17:12PM +0200, Adrien Di Mascio wrote:
> On 24/05/2012 17:01, Pierre-Yves David wrote:
> >On Thu, May 24, 2012 at 04:03:58PM +0200, Sylvain Thénault wrote:
> 
> >Self-contained view is a very dispointing and non-intuitive solution.
> 
> 
> It's unclear to me what a "self-contained view" is. Could you
> elaborate a bit more ?


Possible view argument are defined as class attribute

    class MyView(View):
        __regid__ == 'my_view'

        args1 = False
        args2 = 'babar'
        args3 = 'celestine'


        def call(self, rset):
            if self.arg1:
                self.w(self.args2)
            else:
                self.w(self.args3)

When you want to change argument value, you create a dedicated view. With a
dedicated regid.

    class MyViewWithArg1True(MyView):
        __regid__ == 'my_view_with_arg1_true'
        args1 = True


eg: This is used in table with to control pagination or facet.


-- 
Pierre-Yves David

http://www.logilab.fr/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20120524/65c5a004/attachment-0271.sig>


More information about the Cubicweb mailing list