2 from turbogears import url
3 from turbogears.controllers import Controller
4 from turbogears import identity
7 def __init__(self, base):
9 self.items = filter(lambda i: isinstance(getattr(base, i), Controller), base.__dict__)
11 self.items = ['dashboard'] + self.items
14 return c.require.eval_with_object(identity.current)
17 option = u"""<option value="%s">%s</option>" """
21 <select OnChange="window.location=this.options[this.selectedIndex].value;">
26 s = option % ('', '-----')
28 if i == 'dashboard' or self._check(getattr(self.base, i)):
29 s += option % (url('/' + i), i.capitalize().replace('_', ' '))