class documentation

class Undefined:

Known subclasses: jinja2.runtime.ChainableUndefined, jinja2.runtime.DebugUndefined, jinja2.runtime.StrictUndefined

View In Hierarchy

The default undefined type. This undefined type can be printed and iterated over, but every other access will raise an UndefinedError:

>>> foo = Undefined(name='foo')
>>> str(foo)
''
>>> not foo
True
>>> foo + 42
Traceback (most recent call last):
  ...
jinja2.exceptions.UndefinedError: 'foo' is undefined
Async Method __aiter__ Undocumented
Method __bool__ Undocumented
Method __eq__ Undocumented
Method __getattr__ Undocumented
Method __hash__ Undocumented
Method __init__ Undocumented
Method __iter__ Undocumented
Method __len__ Undocumented
Method __ne__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
Method ​_fail​_with​_undefined​_error Raise an UndefinedError when operations are performed on the undefined value.
Class Variable __slots__ Undocumented
Instance Variable ​_undefined​_exception Undocumented
Instance Variable ​_undefined​_hint Undocumented
Instance Variable ​_undefined​_name Undocumented
Instance Variable ​_undefined​_obj Undocumented
Property ​_undefined​_message Build a message about the undefined value based on how it was accessed.
async def __aiter__(self):

Undocumented

Returns
t.AsyncIterator[t.Any]Undocumented
def __bool__(self):

Undocumented

Returns
boolUndocumented
def __eq__(self, other):

Undocumented

Parameters
other:t.AnyUndocumented
Returns
boolUndocumented
@internalcode
def __getattr__(self, name):

Undocumented

Parameters
name:strUndocumented
Returns
t.AnyUndocumented
def __hash__(self):

Undocumented

Returns
intUndocumented
def __init__(self, hint=None, obj=missing, name=None, exc=UndefinedError):

Undocumented

Parameters
hint:t.Optional[str]Undocumented
obj:t.AnyUndocumented
name:t.Optional[str]Undocumented
exc:t.Type[TemplateRuntimeError]Undocumented
def __iter__(self):

Undocumented

Returns
t.Iterator[t.Any]Undocumented
def __len__(self):

Undocumented

Returns
intUndocumented
def __ne__(self, other):

Undocumented

Parameters
other:t.AnyUndocumented
Returns
boolUndocumented
def __repr__(self):

Undocumented

Returns
strUndocumented
def __str__(self):

Undocumented

Returns
strUndocumented
@internalcode
def _fail_with_undefined_error(self, *args, **kwargs):
Raise an UndefinedError when operations are performed on the undefined value.
Parameters
*args:t.AnyUndocumented
**kwargs:t.AnyUndocumented
Returns
te.NoReturnUndocumented
_undefined_exception =

Undocumented

_undefined_hint =

Undocumented

_undefined_name =

Undocumented

_undefined_obj =

Undocumented

@property
_undefined_message: str =
Build a message about the undefined value based on how it was accessed.