<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="sans-serif">Hi,<br>
<br>
I've just converted my application to use viewlets instead of only
views. After the conversion, some doubts have arisen about which
is the correct way to use them.<br>
<br>
Right now, I have all the code in the update() method from the
views. The viewlets don't have any method, only grok directives
binding them to views, viewlet managers and templates. <br>
<br>
But, as I see it, it should be the other way round. The code in
Viewlet.update() and only directives in the views. This would
allow to reuse a viewlet in different views. However, I can't bind
a viewlet to more than a View. I've tryied the following, but both
fail:<br>
<br>
class TestViewlet(grok.Viewlet):<br>
grok.View(SomeView)<br>
</font><font face="sans-serif"> grok.View(SomeOtherView)</font><br>
<br>
grok.View(SomeView, SomeOtherView)<br>
<br>
The use case I'm thinking is for example a viewlet that displays a
list of objects. I would want to bind it to a view which only shows
this list, but I would also want to link it to a kind of dashboard
view where it is rendered along with other viewlets showing other
information.<br>
<br>
I this the correct/usual way of using viewlets?<br>
<br>
Thanks,<br>
Àlex<br>
</body>
</html>