1 from engine.plugin import Plugin
3 class Composite (Plugin):
5 def __init__ (self, sons=[], *args, **kwds):
6 Plugin.__init__ (self, *args, **kwds)
9 def insert (self, plugin):
10 self.sons.append(plugin)
12 def template_env (self, request):
13 # this is designed so as to support a template like
14 # {% for son in sons %} {{ son.rendered }} ...
15 ranks=range(len(self.sons))
17 [ { 'rendered': son.render(request),
20 'classname': son.classname,
22 for (son,rank) in zip(self.sons,ranks) ]}
24 # xxx need a way to select an active son, like e.g.
25 # Composite (active='some string')
26 # and we could then try to find that string in either title or uuid or some other place
27 # in which case the corresponding 'son' entry in template_env above would son.active=True