Re: Conditionally render viewlet
Jonathan Bowlas <j.bowlas-hclig2XLE9Zaa/[email protected]> Thu, 9 Jun 2011 12:41:51 +0100
| Newsgroups | gmane.comp.web.zope.silva.devel |
|---|---|
| Message-ID | <[email protected]> |
I think that would be best, I'm using it a lot and it seems a bit excessive to include a available() method to every viewlet I want included. (Although I have written a separate silvaviews.Viewlet class called IsAvailable with has the available() method which I subclass when I want a Viewlet available). Cheers J On 9 June 2011 12:28, Sylvain Viollon <[email protected]> wrote: > On Wed, 8 Jun 2011 15:54:05 +0200 > Antonin AMAND <[email protected]> wrote: > > =A0Hello, > >> On Wed, Jun 8, 2011 at 1:37 PM, Jonathan Bowlas <j.bowlas-hclig2XLE9Zaa/[email protected]> >> wrote: >> > Is there an example infrae extension or theme where the filter >> > method is overridden? >> > >> > J >> >> Sorry. filter method takes the viewlets as parameter. >> >> def filter(self, viewlets): >> =A0 =A0viewlets =3D super(LeftColumn, self).filter(viewlets) >> =A0 =A0return [(name, viewlet) for name, viewlet in viewlets if >> viewlet.available()] >> >> > > =A0If this is often used, we could add a base class into > =A0silva.core.views that contains it by default. > > =A0Regards, > > =A0Sylvain, > > > -- > Sylvain Viollon -- Infrae > t +31 10 243 7051 -- http://infrae.com > Hoevestraat 10 3033GC Rotterdam -- The Netherlands > _______________________________________________ > silva-dev mailing list > silva-dev-IAPFreCvJWM6s/[email protected] > https://lists.infrae.com/mailman/listinfo/silva-dev > -- = Jonathan Bowlas Web Support Officer Media Services University College London Email: j.bowlas-hclig2XLE9Zaa/[email protected]