Skip to main content

Chameleon template integration for Morepath

Project description

more.chameleon: Chameleon template integration for Morepath

more.chameleon is an extension for Morepath that adds Zope Page Template (ZPT) support for the .pt extension, using the Chameleon template engine.

For details on the ZPT template language see the Chameleon language reference.

Example usage:

from more.chameleon import ChameleonApp

class App(ChameleonApp):

class Person(object):
     def __init__(self, name): = name

def get_template_directory():
    return 'templates'

@App.html(model=Person, template='')
def person_default(self, request):
    return {'name':}

and then in (in the templates subdirectory):

<p>Hello ${name}!</p>

During development it can be helpful to have Chameleon reload templates automatically after a change. To enable this feature use the MOREPATH_TEMPLATE_AUTO_RELOAD environment variable.

You can enable it for your process:


Or for your shell:


To further control Chameleon rendering you can define a chameleon setting section in your app. For instance, here is how you turn on Chameleon’s debug functionality:

def get_setting_section():
    return {'debug': True}

For details on Chameleon configuration options, consult the configuration keyword arguments in the Chameleon API reference.


0.2 (2016-01-23)

0.1 (2015-04-09)

  • Initial public release.

Project details

Download files

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

Files for more.chameleon, version 0.2
Filename, size & hash File type Python version Upload date
more.chameleon-0.2-py2.py3-none-any.whl (8.5 kB) View hashes Wheel 2.7
more.chameleon-0.2.tar.gz (7.4 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page