Download:
child 108:4fced0617745
parent 106:64250e7006bc
107:699663b276ac
Anton Shestakov <av6@dwimlabs.net>, Tue, 05 Jul 2016 20:42:35 +0800
handlers: split serving different formats for check into different methods

1 файлов изменено, 11 вставок(+), 6 удалений(-) [+]
candolint/handlers.py file | annotate | diff | comparison | revisions
--- a/candolint/handlers.py Tue Jul 05 17:45:29 2016 +0800
+++ b/candolint/handlers.py Tue Jul 05 20:42:35 2016 +0800
@@ -81,13 +81,18 @@
check = get_or_404(Check, project=project, ordinal=check_num)
lines = json_decode(check.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()
+ self.get_raw(project, check, lines)
else:
- self.render('check.html', project=project, check=check, lines=lines)
+ self.get_html(project, check, lines)
+
+ def get_raw(self, project, check, lines):
+ self.set_header('Content-Type', 'text/plain; charset=utf-8')
+ for line in lines:
+ self.write(line['text'])
+ self.write('\n')
+
+ def get_html(self, project, check, lines):
+ self.render('check.html', project=project, check=check, lines=lines)
class StatusHandler(BaseHandler):