[silva-dev] Conditionally render viewlet
Sylvain Viollon
sylvain at infrae.com
Thu Jun 9 13:31:32 CEST 2011
On Wed, 8 Jun 2011 07:25:48 -0500
Andrew Altepeter <aaltepet at bethel.edu> wrote:
> Hi Jon,
>
Hello,
> In your viewlet class, define another method:
>
> def default_namespace(self):
> """add 'skip' to the template's namespace. This method is
> called _after_ update()"""
> namespace = super(MyViewletClass, self).default_namespace()
> namespace['skip'] = self.skip
> return namespace
>
>
You should be able to replace this with:
def namespace(self):
return {'skip': self.skip}
And have the same result.
However surcharging filter on the ViewletManager is the nicest way to
ignore a Viewlet, I think.
Regards,
Sylvain
--
Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands
More information about the silva-dev
mailing list