Download:
child 298:7a103296a019
parent 296:7ae08f18f2b2
297:bb63ea9aa185
Anton Shestakov <av6@dwimlabs.net>, Tue, 19 Sep 2017 22:29:13 +0800
viewer: get reference check in a separate method

1 файлов изменено, 10 вставок(+), 8 удалений(-) [+]
candolint/handlers.py file | annotate | diff | comparison | revisions
--- a/candolint/handlers.py Mon Sep 18 18:52:34 2017 +0800
+++ b/candolint/handlers.py Tue Sep 19 22:29:13 2017 +0800
@@ -145,13 +145,9 @@
self.write(line['text'])
self.write('\n')
- def get_html(self, project, check, lines):
- adapter = project.get_adapter()
- for line in lines:
- if 'filename' in line:
- line['link'] = adapter.get_line_url(check.change, line)
+ def get_reference_check(self, check):
if check.success:
- reference = (Check
+ return (Check
.select(*Check.get_light_fields())
.join(Change)
.where(Check.project == check.project)
@@ -161,8 +157,14 @@
.where(Check.ordinal < check.ordinal)
.order_by(Check.ordinal.desc())
.first())
- else:
- reference = None
+ return None
+
+ def get_html(self, project, check, lines):
+ adapter = project.get_adapter()
+ for line in lines:
+ if 'filename' in line:
+ line['link'] = adapter.get_line_url(check.change, line)
+ reference = self.get_reference_check(check)
self.render('check.html', project=project, check=check, lines=lines, adapter=adapter, reference=reference)