Mercurial > mozilla > hg > talosnames
diff talosnames/web.py @ 40:10945dedde84
get query string working for TBPL suites
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 24 Jul 2012 22:51:40 -0700 |
parents | ef8590b55605 |
children | 4dfa9c298e3d |
line wrap: on
line diff
--- a/talosnames/web.py Tue Jul 24 22:29:37 2012 -0700 +++ b/talosnames/web.py Tue Jul 24 22:51:40 2012 -0700 @@ -30,8 +30,9 @@ tests[suite] = test except: tests[suite] = None + self.suites = suites - self.data = {'suites': suites, + self.data = {'suites': self.suites, 'commands': self.api.buildbot_commands, 'tbpl': dict([(suite, self.api.tbpl_name(suite)) for suite in suites]), @@ -86,13 +87,25 @@ def __call__(self, environ, start_response): request = Request(environ) response = Response(content_type='text/html', - body=self.render()) + body=self.render(request)) return response(environ, start_response) - def render(self): + def render(self, request=None): + data = self.data.copy() + if request and 'tbpl' in request.GET: + tbplnames = [] + for name in request.GET.getall('tbpl'): + if not name.startswith('Talos'): + name = 'Talos ' + name + tbplnames.append(name) + suites = [] + for suite, value in self.data['tbpl'].items(): + if value in tbplnames: + suites.append(suite) + data['suites'] = sorted(suites) contents = file(template).read() _template = tempita.HTMLTemplate(contents) - return _template.substitute(self.data) + return _template.substitute(data) if __name__ == '__main__':