Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Mako template bindings for Morepath

Project description

# more.mako

`more.mako` is an extension for [Morepath]( that adds [Mako](
template support when you use the `.mako` extension.

Example usage:

from more.mako import MakoApp

class App(MakoApp):

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

def get_template_directory():
return 'templates'

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

and then in `person.mako` in the `templates` subdirectory:

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

You can also render defs from templates using the special syntax
`template#defname.mako` like the following example:

@App.html(model=Root, template='defs#hello.mako')
def hello():
return {'name': 'World'}

and then in `defs.mako`:

<%def name="hello(name)">
<p>Hello ${name}!</p>

Note that the Mako documentation uses the `.html` extension for
Mako templates, whereas this extension uses `.mako` instead.

To control Mako behavior you can define a `mako` setting section
in your app, for instance:

def get_setting_section():
return {
'default_filters': ['h'],
'format_exceptions': True

For details on Mako configuration options, consult the [Mako API


0.1.0 (2016-09-08)

- Initial public release

Project details

Release history Release notifications

This version
History Node


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