class documentation

class Context: (source)

View In Hierarchy

Provides runtime namespace, output buffer, and various callstacks for templates. See :ref:`runtime_toplevel` for detail on the usage of :class:`.Context`.

Method __getitem__ Undocumented
Method __init__ Undocumented
Method get Return a value from this :class:`.Context`.
Method keys Return a list of all names established in this :class:`.Context`.
Method pop_caller Pop a ``caller`` callable onto the callstack for this :class:`.Context`.
Method push_caller Push a ``caller`` callable onto the callstack for this :class:`.Context`.
Method write Write a string to this :class:`.Context` object's underlying output buffer.
Method writer Return the current writer function.
Instance Variable caller_stack Undocumented
Instance Variable namespaces Undocumented
Property kwargs Return the dictionary of top level keyword arguments associated with this :class:`.Context`.
Property lookup Return the :class:`.TemplateLookup` associated with this :class:`.Context`.
Method _clean_inheritance_tokens create a new copy of this :class:`.Context`. with tokens related to inheritance state removed.
Method _copy Undocumented
Method _locals Create a new :class:`.Context` with a copy of this :class:`.Context`'s current state, updated with the given dictionary.
Method _pop_buffer pop the most recent capturing buffer from this Context.
Method _pop_buffer_and_writer pop the most recent capturing buffer from this Context and return the current writer after the pop.
Method _push_buffer push a capturing buffer onto this Context.
Method _push_writer push a capturing buffer onto this Context and return the new writer function.
Method _set_with_template Undocumented
Instance Variable _buffer_stack Undocumented
Instance Variable _data Undocumented
Instance Variable _kwargs Undocumented
Instance Variable _outputting_as_unicode Undocumented
Instance Variable _with_template Undocumented
def __getitem__(self, key): (source)

Undocumented

def __init__(self, buffer, **data): (source)

Undocumented

def get(self, key, default=None): (source)

Return a value from this :class:`.Context`.

def keys(self): (source)

Return a list of all names established in this :class:`.Context`.

def pop_caller(self): (source)

Pop a ``caller`` callable onto the callstack for this :class:`.Context`.

def push_caller(self, caller): (source)

Push a ``caller`` callable onto the callstack for this :class:`.Context`.

def write(self, string): (source)

Write a string to this :class:`.Context` object's underlying output buffer.

def writer(self): (source)

Return the current writer function.

caller_stack = (source)

Undocumented

namespaces: dict = (source)

Undocumented

Return the dictionary of top level keyword arguments associated with this :class:`.Context`. This dictionary only includes the top-level arguments passed to :meth:`.Template.render`. It does not include names produced within the template execution such as local variable names or special names such as ``self``, ``next``, etc. The purpose of this dictionary is primarily for the case that a :class:`.Template` accepts arguments via its ``<%page>`` tag, which are normally expected to be passed via :meth:`.Template.render`, except the template is being called in an inheritance context, using the ``body()`` method. :attr:`.Context.kwargs` can then be used to propagate these arguments to the inheriting template:: ${next.body(**context.kwargs)}

Return the :class:`.TemplateLookup` associated with this :class:`.Context`.

def _clean_inheritance_tokens(self): (source)

create a new copy of this :class:`.Context`. with tokens related to inheritance state removed.

def _copy(self): (source)

Undocumented

def _locals(self, d): (source)

Create a new :class:`.Context` with a copy of this :class:`.Context`'s current state, updated with the given dictionary. The :attr:`.Context.kwargs` collection remains unaffected.

def _pop_buffer(self): (source)

pop the most recent capturing buffer from this Context.

def _pop_buffer_and_writer(self): (source)

pop the most recent capturing buffer from this Context and return the current writer after the pop.

def _push_buffer(self): (source)

push a capturing buffer onto this Context.

def _push_writer(self): (source)

push a capturing buffer onto this Context and return the new writer function.

def _set_with_template(self, t): (source)

Undocumented

_buffer_stack = (source)

Undocumented

Undocumented

Undocumented

_outputting_as_unicode = (source)

Undocumented

_with_template = (source)

Undocumented