Skip to main content

Mako renderer for lribeiro.cherrypy.templating

Project description

Mako renderer for lribeiro.cherrypy.templating

It has two optional config entries:

  • templating.mako.template_directories: can be a path to the templates directory, absolute (with leading slash) or relative to the root module location, or a list of paths. If none is given, {root directory}/templates is used.
  • templating.mako.config: any additional arguments to be passed to the TemplateLookup constructor

Developed under Python3.4 and tested against Python2.7, Python3.4 and pypy.

Usage:

import cherrypy

from lribeiro.cherrypy.templating import template
from lribeiro.cherrypy.templating.mako import renderer


class Root(object):
    @cherrypy.expose
    @template('index.html')
    def index(self):
        return {'context': 'variables'}

    @cherrypy.expose
    @template('/page.html')
    def page(self):
        return {'context': 'variables'}


config = {
    '/': {
        'templating.renderer': renderer,
        'templating.mako.template_directories': 'mako_templates',  # optional
        'templating.mako.config': {'module_directory': '/tmp/modules'}  # also optional
    }
}

if __name__ == '__main__':
    cherrypy.quickstart(Root(), '/', config)

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for lribeiro.cherrypy.templating.mako, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size lribeiro.cherrypy.templating.mako-1.0-py2.py3-none-any.whl (5.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size lribeiro.cherrypy.templating.mako-1.0.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page