Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@authenticated()
@template.output("pipeline_index.html")
def edit(self, pipeline_id):
pipelines = self.repository.get_all()
pipeline = self.repository.get(pipeline_id)
return template.render(authenticated=self.authenticated(), pipeline=pipeline, pipelines=pipelines, errors=None)
move_to_site(filename, dest)
continue
page_meta = template.get_meta_data(filename)
page_url = os.path.join(
'/',
os.path.splitext(
page_meta['filename'].split(self.work_dir)[1][1:])[0])
page_meta['url'] = page_url
self.pages.append(page_meta)
# paginate if needed
if page_meta.get('paginate', False):
self.paginate(filename, page_meta)
continue
html = template.render(page_meta['raw'], {'page': page_meta})
page_path = os.path.join(
self.config.site_dir,
filename.split(self.work_dir)[1][1:])
page_path = self.get_page_name_for_site(page_path)
log.debug('Generating page %s' % page_path)
# write the rendered page
write_html(page_path, html)
def get(self):
self.response.write(template.render('sadCat.html'))
def get(self):
self.response.write(template.render('docs.html'))
def render_home_page(self):
self.response.write(template.render('home.html'))
def render_details(self, project_id, build_id = None):
project = self.repository.get(project_id)
if not build_id:
build = project.last_builds and project.last_builds[0] or None
else:
build = project.get_build_by_id(int(build_id))
build_log = ""
if build and build.log:
build_log = highlight(build.log, BashLexer(), HtmlFormatter())
return template.render(authenticated=self.authenticated(), project=project, current_build=build, build_log=build_log)
@template.output("pipeline_index.html")
def index(self):
pipelines = self.repository.get_all()
return template.render(authenticated=self.authenticated(), pipeline=None, pipelines=pipelines, errors=None)
app.internalerror = lambda: web.internalerror(
render.error(500, 'Internal Server Error'))
@template.output("dashboard.html")
def dashboard(self):
repository = ProjectRepository()
projects = repository.get_all()
return template.render(authenticated=self.authenticated(), projects=projects)
def ext_download(loader, inputhash, abs_source, dest, **kwargs):
""" Downloads a ~download file"""
contents = yaml.load(render(abs_source, inputhash, loader))
jsonschema.validate(contents, SCHEMA)
finalfile = get_filename(dest)
handle = open(finalfile, 'w')
auth = None
if 'username' in contents and 'password' in contents:
auth = (contents['username'], contents['password'])
_download_file(contents['url'], handle, auth)
return finalfile