How to use the template.render function in template

To help you get started, we’ve selected a few template examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heynemann / skink / skink / controllers / __init__.py View on Github external
    @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)
github semk / voldemort / voldemort / __init__.py View on Github external
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)
github google / beautiful-audio-editor / src / python / audiocatapp / main.py View on Github external
def get(self):
    self.response.write(template.render('sadCat.html'))
github google / beautiful-audio-editor / src / python / audiocatapp / main.py View on Github external
def get(self):
    self.response.write(template.render('docs.html'))
github google / beautiful-audio-editor / src / python / audiocatapp / main.py View on Github external
def render_home_page(self):
    self.response.write(template.render('home.html'))
github heynemann / skink / skink / controllers / __init__.py View on Github external
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)
github heynemann / skink / skink / controllers / __init__.py View on Github external
    @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)
github w0rm / todo / code.py View on Github external
app.internalerror = lambda: web.internalerror(
        render.error(500, 'Internal Server Error'))
github heynemann / skink / skink / controllers / __init__.py View on Github external
    @template.output("dashboard.html")
    def dashboard(self):
        repository = ProjectRepository()
        projects = repository.get_all()
        return template.render(authenticated=self.authenticated(), projects=projects)
github gosquadron / squadron / squadron / exthandlers / download.py View on Github external
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