class documentation

Provides access to collections of rendering methods, which can be local, from other templates, or from imported modules. To access a particular rendering method referenced by a :class:`.Namespace`, use plain attribute access: .. sourcecode:: mako ${some_namespace.foo(x, y, z)} :class:`.Namespace` also contains several built-in attributes described here.

Method __getattr__ Undocumented
Method __init__ Undocumented
Method get_cached Return a value from the :class:`.Cache` referenced by this :class:`.Namespace` object's :class:`.Template`.
Method get_namespace Return a :class:`.Namespace` corresponding to the given ``uri``.
Method get_template Return a :class:`.Template` from the given ``uri``.
Method include_file Include a file at the given ``uri``.
Class Variable filename The path of the filesystem file used for this :class:`.Namespace`'s module or template.
Class Variable module The Python module referenced by this :class:`.Namespace`.
Class Variable template The :class:`.Template` object referenced by this :class:`.Namespace`, if any.
Class Variable uri The URI for this :class:`.Namespace`'s template.
Instance Variable callables Undocumented
Instance Variable context The :class:`.Context` object for this :class:`.Namespace`.
Instance Variable inherits Undocumented
Instance Variable name Undocumented
Property attr Access module level attributes by name.
Property cache Return the :class:`.Cache` object referenced by this :class:`.Namespace` object's :class:`.Template`.
Method _get_star Undocumented
Method _populate Undocumented
Class Variable _templateuri Undocumented
def __getattr__(self, key): (source)
def __init__(self, name, context, callables=None, inherits=None, populate_self=True, calling_uri=None): (source)
def get_cached(self, key, **kwargs): (source)

Return a value from the :class:`.Cache` referenced by this :class:`.Namespace` object's :class:`.Template`. The advantage to this method versus direct access to the :class:`.Cache` is that the configuration parameters declared in ``<%page>`` take effect here, thereby calling up the same configured backend as that configured by ``<%page>``.

def get_namespace(self, uri): (source)

Return a :class:`.Namespace` corresponding to the given ``uri``. If the given ``uri`` is a relative URI (i.e. it does not contain a leading slash ``/``), the ``uri`` is adjusted to be relative to the ``uri`` of the namespace itself. This method is therefore mostly useful off of the built-in ``local`` namespace, described in :ref:`namespace_local`. In most cases, a template wouldn't need this function, and should instead use the ``<%namespace>`` tag to load namespaces. However, since all ``<%namespace>`` tags are evaluated before the body of a template ever runs, this method can be used to locate namespaces using expressions that were generated within the body code of the template, or to conditionally use a particular namespace.

def get_template(self, uri): (source)

Return a :class:`.Template` from the given ``uri``. The ``uri`` resolution is relative to the ``uri`` of this :class:`.Namespace` object's :class:`.Template`.

def include_file(self, uri, **kwargs): (source)

Include a file at the given ``uri``.

filename = (source)

The path of the filesystem file used for this :class:`.Namespace`'s module or template. If this is a pure module-based :class:`.Namespace`, this evaluates to ``module.__file__``. If a template-based namespace, it evaluates to the original template file location.

The Python module referenced by this :class:`.Namespace`. If the namespace references a :class:`.Template`, then this module is the equivalent of ``template.module``, i.e. the generated module for the template.

template = (source)

The :class:`.Template` object referenced by this :class:`.Namespace`, if any.

The URI for this :class:`.Namespace`'s template. I.e. whatever was sent to :meth:`.TemplateLookup.get_template()`. This is the equivalent of :attr:`.Template.uri`.

The :class:`.Context` object for this :class:`.Namespace`. Namespaces are often created with copies of contexts that contain slightly different data, particularly in inheritance scenarios. Using the :class:`.Context` off of a :class:`.Namespace` one can traverse an entire chain of templates that inherit from one-another.

Access module level attributes by name. This accessor allows templates to supply "scalar" attributes which are particularly handy in inheritance relationships. .. seealso:: :ref:`inheritance_attr` :ref:`namespace_attr_for_includes`

Return the :class:`.Cache` object referenced by this :class:`.Namespace` object's :class:`.Template`.

def _populate(self, d, l): (source)

Undocumented

_templateuri = (source)

Undocumented