The accessor module offers two important front-end functions: kgetattr and ksetattr. These functions allow retrieving attribute values from objects much in the same way as getattr/setattr allow, but with two important differences:
Function | get_default_getter | Obtains from model a callable through which attr_name can be |
Function | get_default_setter | Obtains from model a callable through which attr_name can be |
Class | CacheControl | Undocumented |
Class | _AttrUnset | Undocumented |
Class | DefaultValue | This can be raised in kgetattr accessors to indicate that the default |
Function | kgetattr_guard | Undocumented |
Function | ksetattr_guard | Undocumented |
Function | kgetattr | Returns the value associated with the attribute in model |
Function | ksetattr | Set the value associated with the attribute in model |
Function | enable_attr_cache | Enables the use of the kgetattr cache when using Python |
Function | clear_attr_cache | Clears the kgetattr cache. It must be called repeatedly to |
Obtains from model a callable through which attr_name can be retrieved. This callable is an accessor named get_foo, where foo is the value of attr_name, or getattr(model, foo) if the accessor does not exist. If the callable exists, it is returned; if getattr() is to be used a tuple in the format (model, attr_name) is returned.
Obtains from model a callable through which attr_name can be set. This callable is an accessor named set_foo, where foo is the value of attr_name, or setattr(model, foo, value) if the accessor does not exist. If the callable exists, it is returned; if setattr() is to be used a tuple in the format (model, attr_name) is returned.
Returns the value associated with the attribute in model named by attr_name. If default is provided and model does not have an attribute called attr_name, the default value is returned. If flat=1 is specified, no dot path parsing will be done.
Set the value associated with the attribute in model named by attr_name. If flat=1 is specified, no dot path parsing will be done.
Enables the use of the kgetattr cache when using Python versions that do not support weakrefs (1.5.x and earlier). Be warned, using the cache in these versions causes leaked references to accessor methods and models!
Clears the kgetattr cache. It must be called repeatedly to avoid memory leaks in Python 2.0 and earlier.