Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def download_buildlog(id):
l = db_session.query(BuildLog).filter(BuildLog.id == id).first()
if not l:
return abort(404)
path = os.path.join(settings.CORE_BUILD_LOG_PATH, '{:d}.txt'.format(l.id))
if not os.path.exists(path):
return abort(404)
with open(path) as f:
text = f.read()
html = ansi2html(text, palette='console')
return render_template('buildlog.html', log=html, buildlog=l)
def download_runlog(id):
r = db_session.query(TestRun).filter(TestRun.id == id).first()
if not r:
return abort(404)
path = os.path.join(settings.CORE_TESTRUN_STDERR_PATH, '{:d}.txt'.format(r.id))
if not os.path.exists(path):
return abort(404)
with open(path) as f:
text = f.read()
html = ansi2html(text, palette='console')
return render_template('runlog.html', log=html, testrun=r)