Download:
child 100:403f302df870
parent 98:c922c588315e
99:b0bcc3b9dc46
Anton Shestakov <av6@dwimlabs.net>, Mon, 04 Jul 2016 17:12:56 +0800
viewer: allow viewing checker output as plain text

2 файлов изменено, 12 вставок(+), 3 удалений(-) [+]
templates/check.html file | annotate | diff | comparison | revisions
viewer.py file | annotate | diff | comparison | revisions
--- a/templates/check.html Mon Jul 04 16:35:41 2016 +0800
+++ b/templates/check.html Mon Jul 04 17:12:56 2016 +0800
@@ -25,6 +25,8 @@
<dd>{% module Time(check.finished) %}</dd>
<dt>Duration:</dt>
<dd>{{ check.get_duration() }}</dd>
+ <dt>Other formats:</dt>
+ <dd><a href="{{ check.get_url() }}/raw">raw</a></dd>
</dl>
</div>
<div class="uk-width-medium-2-3">
--- a/viewer.py Mon Jul 04 16:35:41 2016 +0800
+++ b/viewer.py Mon Jul 04 17:12:56 2016 +0800
@@ -88,14 +88,21 @@
class CheckHandler(BaseHandler):
- def get(self, domain, user, name, check_num):
+ def get(self, domain, user, name, check_num, format_='html'):
project = get_project_or_404(domain, user, name)
if check_num == 'latest':
check = get_or_404(Check, project=project)
else:
check = get_or_404(Check, project=project, ordinal=check_num)
lines = json_decode(check.lines)
- self.render('check.html', project=project, check=check, lines=lines)
+ if format_ == 'raw':
+ self.set_header('Content-Type', 'text/plain; charset=utf-8')
+ for line in lines:
+ self.write(line['text'])
+ self.write('\n')
+ self.finish()
+ else:
+ self.render('check.html', project=project, check=check, lines=lines)
class StatusHandler(BaseHandler):
@@ -132,7 +139,7 @@
handlers = [
URLSpec(r'/', IndexHandler),
URLSpec(r'/([.a-z0-9_-]+)/([^/]+)/([^/]+)', ProjectHandler),
- URLSpec(r'/([.a-z0-9_-]+)/([^/]+)/([^/]+)/([\d]+|latest)', CheckHandler),
+ URLSpec(r'/([.a-z0-9_-]+)/([^/]+)/([^/]+)/([\d]+|latest)(?:/(raw))?', CheckHandler),
URLSpec(r'/([.a-z0-9_-]+)/([^/]+)/([^/]+)/status\.svg', StatusHandler),
URLSpec(r'.*', ErrorHandler, {'status_code': 404})
]