2.2. Context Protocol#
Caterpillar provides a special protocol for working with contexts. It is designed to enable access to context variables while packing or unpacking data. This procotol is implemented by all context-related classes in this package.
- object.__context_getattr__(self, path) object
This function is used to retrieve a value from the context. It is implementation dependent whether nested paths are supported. By default, multiple path elements are sperated by a single dot.
For example, consider the following path:
"foo.bar"
. The context implementation should first resolve the value of"foo"
and then retrieve the value of"bar"
from the result.