1 from engine.plugin import Plugin
3 class Composite (Plugin):
5 def __init__ (self, sons=[], active=None, *args, **kwds):
6 Plugin.__init__ (self, *args, **kwds)
10 def insert (self, plugin):
11 self.sons.append(plugin)
13 # xxx currently there is no guarantee that exactly one son will be active
14 def template_env (self, request):
15 # this is designed so as to support a template like
16 # {% for son in sons %} {{ son.rendered }} ...
18 # print 'comparing >%s< and >%s<'%(son.domid,self.active)
19 return son.domid==self.active
20 ranks=range(len(self.sons))
22 [ { 'rendered': son.render(request),
24 'active': is_active(son),
25 # this should probably come from son._settings..
28 'classname': son.classname,
30 for (son,rank) in zip(self.sons,ranks) ]}