This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Genshi renderer for lribeiro.cherrypy.templating

It has three optional config entries:

  • templating.genshi.template_directories: can be a path to the templates directory, list of paths, or anything genshi.template.TemplateLoader accepts. If none is given, {root module directory}/templates is used as the template diretory.
  • templating.genshi.loader_options: dict containing additional arguments passed to the TemplateLoader constructor
  • templating.genshi.render_options: dict containing arguments used when rendering the template, for example, {‘method’: ‘html’, ‘doctype’: ‘html-transitional’}

You can also pass arguments to the render via @template decorator args and kwargs.

class Controller:
    @template('template_name.html', method='xhtml', doctype='xhtml11')
    def handler(self):

When setting the template name, remember that Genshi interprets a leading slash as an absolute path! So the following would probably raise a TemplateNotFound:

class WrongController:
    # pay attention to the leading slash
    # Genshi will look for a 'wrong_template_name.html' file on the root of the filesystem
    def wrong_handler(self):

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


import cherrypy

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

class Root(object):
    def index(self):
        return {'context': 'variables'}

    @template('/var/templates/page.html')  # absolute path
    def page(self):
        return {'context': 'variables'}

config = {
    '/': {
        'templating.renderer': renderer,
        'templating.genshi.template_directories': [
            'templates',  # relative to the module where the root class was declared
            '/var/templates'  # absolute path
        'templating.genshi.loader_options': {'default_encoding': 'utf-8'},  # this is optional
        'templating.genshi.render_options': {'method': 'html', 'doctype': 'html5'}  # this is also optional

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

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
lribeiro.cherrypy.templating.genshi-1.0-py2.py3-none-any.whl (7.0 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Sep 11, 2014
lribeiro.cherrypy.templating.genshi-1.0.tar.gz (3.8 kB) Copy SHA256 Checksum SHA256 Source Sep 11, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting