Table Of Contents

Previous topic

node.ext.directory

Next topic

node.ext.python

This Page

node.ext.template

API

class node.ext.template.SectionedTemplate(*args, **kw)

Bases: node.ext.template.template.TemplateBase, node.ext.template.codesectionhandler.CodeSectionHandler

Template implementation providing to handle code sections.

handlesections(existent, generated)

Read code sections from existent buffer and fill those one found in generated buffer.

class node.ext.template.JinjaTemplate(*args, **kw)

Bases: node.ext.template.template.SectionedTemplate

Template handler using jinja2.Template templates for output generation.

execjinja()
class node.ext.template.XMLTemplate(*args, **kw)

Bases: node.ext.template.template.DTMLTemplate

Template handler for XML files.

SECTION_BEGIN = '<!-- code-section'
SECTION_END = '<!-- /code-section'
SECTION_POSTFIX = ' -->'
class node.ext.template.ZPTemplate(body, **config)

Bases: chameleon.zpt.template.PageTemplate

Template handler for zope page templates

interface node.ext.template.interfaces.ITemplate

Extends: node.ext.directory.interfaces.IFile

A template.

template

Template source path

class node.ext.template.codesectionhandler.CodeSectionHandler(lines)

Class CodeSectionHandler is responsible to get and set code sections inside some kind of code buffer.

A code section starts with self.BEGIN_PATTERN % sectionname and ends with self.END_PATTERN % sectionname...

..., where self.BEGIN_PATTERN defines a protected section and the following string, the example sectionname is the identifier or name of the section, since we want to be able to define several protected sections.

You can control begin and end patterns due self.SECTION_BEGIN and self.SECTION_END attributes.

BEGIN_PATTERN
END_PATTERN
SECTION_BEGIN = '##code-section'
SECTION_END = '##/code-section'
SECTION_POSTFIX = ''
getsection(name)

Return contents of the code section by name.

@param name: name of the section

sectionnames

List of existent section names in code buffer.

setsection(name, code)

Set the contents of code section by name.

@param name: name of the section @param code: list of codelines