[Grok-dev] An History of Viewlet

Souheil CHELFOUH trollfot at gmail.com
Thu Nov 11 06:44:35 EST 2010


Hello Grokkers !

Yesterday and today, on the #grok channel, an interesting topic has
been discussed : the availability of viewlets.
In Grok, the viewlet manager inherits directly from the Zope viewlet
manager, and its behavior is the same.
However, in our projects, we tend to override the behavior to add a
very common need : a way to switch viewlets on and off, according to a
simple computation.
We thought that we could introduce the "available" method, that would
return a boolean and therefore, prevent calling the ZPT armada, when
no rendering is needed.
The discussion on the channel was mainly to try and find the good
place to compute and use this value.
The consensus is the following : the available method should be called
before the update (so, if you need specific needs in the availability
computing, we'd need to do it in __init__) and then, we could use the
filter method to do so and "dump" the unavailable viewlets.

We await your opinion, guys and we'll start working on that very soon.
- Souheil


More information about the Grok-dev mailing list