Documentation in progress Edit me on GitHub


class Template(name)

Inherit from this base class and override methods to use the Pyramid scaffolding system.

post(command, output_dir, vars)

Called after template is applied.

pre(command, output_dir, vars)

Called before template is applied.

render_template(content, vars, filename=None)

Return a bytestring representing a templated file based on the input (content) and the variable names defined (vars). filename is used for exception reporting.


Return the template directory of the scaffold. By default, it returns the value of os.path.join(self.module_dir(), self._template_dir) (self.module_dir() returns the module in which your subclass has been defined). If self._template_dir is a tuple this method just returns the value instead of trying to construct a path. If _template_dir is a tuple, it should be a 2-element tuple: (package_name, package_relative_path).

class PyramidTemplate(name)[source]

A class that can be used as a base class for Pyramid scaffolding templates.

post(command, output_dir, vars)[source]

Overrides, to print "Welcome to Pyramid. Sorry for the convenience." after a successful scaffolding rendering.

pre(command, output_dir, vars)[source]

Overrides pyramid.scaffolds.template.Template.pre(), adding several variables to the default variables list (including random_string, and package_logger). It also prevents common misnamings (such as naming a package "site" or naming a package logger "root".

Previous topic


Next topic