class documentation

class Variable: (source)

View In Hierarchy

A template variable, resolvable against a given context. The variable may be a hard-coded string (if it begins and ends with single or double quote marks):: >>> c = {'article': {'section':'News'}} >>> Variable('article.section').resolve(c) 'News' >>> Variable('article').resolve(c) {'section': 'News'} >>> class AClass: pass >>> c = AClass() >>> c.article = AClass() >>> c.article.section = 'News' (The example assumes VARIABLE_ATTRIBUTE_SEPARATOR is '.')

Method __init__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
Method resolve Resolve this variable against a given context.
Class Variable __slots__ Undocumented
Instance Variable literal Undocumented
Instance Variable lookups Undocumented
Instance Variable message_context Undocumented
Instance Variable translate Undocumented
Instance Variable var Undocumented
Method _resolve_lookup Perform resolution of a real variable (i.e. not a literal) against the given context.
def __init__(self, var): (source)

Undocumented

def __repr__(self): (source)

Undocumented

def __str__(self): (source)

Undocumented

def resolve(self, context): (source)

Resolve this variable against a given context.

__slots__: tuple[str, ...] = (source)

Undocumented

Undocumented

Undocumented

message_context = (source)

Undocumented

translate: bool = (source)

Undocumented

Undocumented

def _resolve_lookup(self, context): (source)

Perform resolution of a real variable (i.e. not a literal) against the given context. As indicated by the method's name, this method is an implementation detail and shouldn't be called by external code. Use Variable.resolve() instead.