[FIX] runbot: correct badge route

This commit is contained in:
Christophe Simonis 2014-06-11 00:05:41 +02:00
parent c731d4abf1
commit e3fe1ef28d

View File

@ -902,7 +902,7 @@ class RunbotController(http.Controller):
def badge(self, repo, branch, ext): def badge(self, repo, branch, ext):
domain = [('repo_id', '=', repo.id), domain = [('repo_id', '=', repo.id),
('branch_id.name', '=', branch), ('branch_id.branch_name', '=', branch),
('branch_id.sticky', '=', True), ('branch_id.sticky', '=', True),
('state', 'in', ['testing', 'running', 'done']), ('state', 'in', ['testing', 'running', 'done']),
] ]
@ -929,11 +929,16 @@ class RunbotController(http.Controller):
'success': 'brightgreen', 'success': 'brightgreen',
'failed': 'red', 'failed': 'red',
# 'warning': 'orange', # 'warning': 'orange',
}[badge['state']] }[badge['status']]
url = 'http://img.shields.io/badge/{name}-{status}-{color}.{format}'.format(badge) url = 'http://img.shields.io/badge/{name}-{status}-{color}.{format}'.format(**badge)
image = requests.get(url) image = requests.get(url)
return werkzeug.wrappers.Response(image.content, status=image.status_code, headers=image.headers) content = image.content
headers = werkzeug.datastructures.Headers()
headers.extend(image.headers.items())
headers['Content-Length'] = len(content)
headers.remove('content-encoding')
return werkzeug.wrappers.Response(content, status=image.status_code, headers=headers.items())
LABELS = { LABELS = {