Using Breve with TurboGears
  1. Installation
  2. Configuration
  3. Writing a Controller
  4. Known Issues
  5. Back to Main Documentation

Installation

TurboGears will automatically register Brevé as a template engine. There is nothing additional to do.

Configuration

You need to set a minimum of one option in your config file:

[global]
breve.root = 'myproject.templates'

Then all you need to do is prefix the path to your template with 'breve:'.

For example:

@expose ( template = 'breve:index' )
def index ( self ):
    return { }

Note that unlike some other TurboGears templates, Brevé templates are all relative to breve.root. This includes references to templates from within templates (i.e. via the include and inherits directives).

Writing a Controller

@expose ( template = 'breve:index' )
def index ( self ):
    return { }

Known Issues

TurboGears has a rather convoluted and specific initialization sequence. This makes it difficult to pass configuration options to template engines. If you find yourself unable to set a Brevé option from the configuration file, there are a couple workarounds you can try.

1) Modify the Template class

At the top of your controllers.py file, add the following:

from breve import Template
Template.debug = False
Template.tidy = True

You can use this method to set whatever configuration options you like.

edit page
Back to top
Rendered using Brevé 1.3.0Copyright © 2007, Cliff Wells