def files_build(name, id, path = ""): project = models.Project.get(name = name) build = models.Build.get(project = name, id = id) file_path = build.get_file_path(path) is_directory = os.path.isdir(file_path) if not is_directory: return flask.send_file(file_path) if path and not path.endswith("/"): return flask.redirect( flask.url_for( "files_build", name = name, id = id, path = path + "/" ) ) files = build.get_files(path) return flask.render_template( "build_files.html.tpl", link = "projects", sub_link = "files", project = project, build = build, path = path, files = files )
def run_project(name): # retrieves the "custom" run function to be used # as the work "callable", note that the schedule flag # is not set meaning that no schedule will be done # after the execution project = models.Project.get(name=name) _run = project.get_run(schedule=False) # starts the running of the run method in a background # fashion (another thread) so that no blocking occurs quorum.run_back(_run) return flask.redirect(flask.url_for("show_project", name=name))
def create_project(): # creates the new project, using the provided arguments and # then saves it into the data source, all the validations # should be ran upon the save operation project = models.Project.new() try: project.save() except quorum.ValidationError as error: return flask.render_template("project_new.html.tpl", link="new project", project=error.model, errors=error.errors) return flask.redirect(flask.url_for("show_project", name=project.name))
def run_project(name): # retrieves the "custom" run function to be used # as the work "callable", note that the schedule flag # is not set meaning that no schedule will be done # after the execution project = models.Project.get(name = name) _run = project.get_run(schedule = False) # starts the running of the run method in a background # fashion (another thread) so that no blocking occurs quorum.run_back(_run) return flask.redirect( flask.url_for("show_project", name = name) )
def create_project(): # creates the new project, using the provided arguments and # then saves it into the data source, all the validations # should be ran upon the save operation project = models.Project.new() try: project.save() except quorum.ValidationError as error: return flask.render_template( "project_new.html.tpl", link = "new project", project = error.model, errors = error.errors ) return flask.redirect( flask.url_for("show_project", name = project.name) )
def update_project(name): # finds the current project and applies the provided # arguments and then saves it into the data source, # all the validations should be ran upon the save operation project = models.Project.get(name=name) project.apply() try: project.save() except quorum.ValidationError as error: return flask.render_template("project_edit.html.tpl", link="projects", sub_link="edit", project=error.model, errors=error.errors) # redirects the user to the show page of the project that # was just updated return flask.redirect(flask.url_for("show_project", name=name))
def files_build(name, id, path=""): project = models.Project.get(name=name) build = models.Build.get(project=name, id=id) file_path = build.get_file_path(path) is_directory = os.path.isdir(file_path) if not is_directory: return flask.send_file(file_path) if path and not path.endswith("/"): return flask.redirect( flask.url_for("files_build", name=name, id=id, path=path + "/")) files = build.get_files(path) return flask.render_template("build_files.html.tpl", link="projects", sub_link="files", project=project, build=build, path=path, files=files)
def update_project(name): # finds the current project and applies the provided # arguments and then saves it into the data source, # all the validations should be ran upon the save operation project = models.Project.get(name = name) project.apply() try: project.save() except quorum.ValidationError as error: return flask.render_template( "project_edit.html.tpl", link = "projects", sub_link = "edit", project = error.model, errors = error.errors ) # redirects the user to the show page of the project that # was just updated return flask.redirect( flask.url_for("show_project", name = name) )
def delete_project(name): project = models.Project.get(name = name) project.delete() return flask.redirect( flask.url_for("list_projects") )
def delete_build(name, id): build = models.Build.get(project = name, id = id) build.delete() return flask.redirect( flask.url_for("list_builds", name = name) )
def delete_project(name): project = models.Project.get(name=name) project.delete() return flask.redirect(flask.url_for("list_projects"))
def delete_build(name, id): build = models.Build.get(project=name, id=id) build.delete() return flask.redirect(flask.url_for("list_builds", name=name))