The shadow module provides objects that act as intermediaries for other objects, exposing selected attributes of the original object and masking the rest. Like the Python Bastion module, shadow provides a controlled interface between trusted and untrusted code.
A close cousin of bastions, shadow objects offer a different form of access to the object being reflected:
This module defines the following class:
Getting values in the shadow for attributes listed in defers gets the values from the original, and changing values for those attributes in the shadow applies the changes to the attributes of original. Getting the value of an attribute listed in defers which does not exist on the original object causes an AttributeError exception. Setting an attribute listed in defers that does not already exist in the original causes it to be created in the original.
Conversely, getting and setting attribute values for attributes not on the defers list applies, in the normal ways, only to the shadow object, not to the original.
No special methods are provided, but many disciplines for attribute management are implemented to provide the required functionality.
This module defines the following function: