Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.support.werkzeug.contrib.kickstart.TemplateLoader Class Reference
Inheritance diagram for MoinMoin.support.werkzeug.contrib.kickstart.TemplateLoader:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def get_template
def render_to_response
def render_to_string

Public Attributes

 search_path
 encoding

Detailed Description

A simple loader interface for the werkzeug minitmpl
template language.

Definition at line 204 of file kickstart.py.


Constructor & Destructor Documentation

def MoinMoin.support.werkzeug.contrib.kickstart.TemplateLoader.__init__ (   self,
  search_path,
  encoding = 'utf-8' 
)

Definition at line 210 of file kickstart.py.

00210 
00211     def __init__(self, search_path, encoding='utf-8'):
00212         self.search_path = path.abspath(search_path)
00213         self.encoding = encoding


Member Function Documentation

Get a template from a given name.

Reimplemented in MoinMoin.support.werkzeug.contrib.kickstart.GenshiTemplateLoader.

Definition at line 214 of file kickstart.py.

00214 
00215     def get_template(self, name):
00216         """Get a template from a given name."""
00217         filename = path.join(self.search_path, *[p for p in name.split('/')
00218                                                  if p and p[0] != '.'])
00219         if not path.exists(filename):
00220             raise TemplateNotFound(name)
00221         return Template.from_file(filename, self.encoding)

Here is the caller graph for this function:

Load and render a template into a response object.

Definition at line 222 of file kickstart.py.

00222 
00223     def render_to_response(self, *args, **kwargs):
00224         """Load and render a template into a response object."""
00225         return Response(self.render_to_string(*args, **kwargs))

Here is the call graph for this function:

Load and render a template into a unicode string.

Reimplemented in MoinMoin.support.werkzeug.contrib.kickstart.GenshiTemplateLoader.

Definition at line 226 of file kickstart.py.

00226 
00227     def render_to_string(self, *args, **kwargs):
00228         """Load and render a template into a unicode string."""
00229         try:
00230             template_name, args = args[0], args[1:]
00231         except IndexError:
00232             raise TypeError('name of template required')
00233         return self.get_template(template_name).render(*args, **kwargs)
00234 

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 211 of file kickstart.py.


The documentation for this class was generated from the following file: