<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt">Hi, guys.<br><br>I was wondering why viewlets in Grok, like viewlets in Plone, don't have a method to check their availability at the render time.<br>This would be as simple as changing the last line in the render method of the ViewletManager component (grokcore.viewlet:components.py):<br><br>class ViewletManager(ViewletManagerBase):<br> ...<br> def render(self):<br> ....<br> -- return u'\n'.join([viewlet.render() for viewlet in self.viewlets])<br> ++ return u'\n'.join([viewlet.render() for viewlet in self.viewlets <span style="font-weight: bold;">if viewlet.available()</span>])<br><br>and adding the available method to Viewlet:<br><br>class Viewlet(ViewletBase):<br> ...<br><br>
<span style="font-weight: bold;">def available(self):</span><br style="font-weight: bold;"><span style="font-weight: bold;"> return True</span><br></div></body></html>