Bound attributes are attributes that are bound to a specific class and a specific name. In SQLObject a typical example is a column object, which knows its name and class.

A bound attribute should define a method __addtoclass__(added_class, name) (attributes without this method will simply be treated as normal). The return value is ignored; if the attribute wishes to change the value in the class, it must call setattr(added_class, name, new_value).

BoundAttribute is a class that facilitates lazy attribute creation.


a __package__



C BoundAttribute(...) ...

This is a declarative class that passes all the values given to it to another object. So you can pass it arguments (via __init__/__call__) or give it the equivalent of keyword arguments through subclassing. Then a bound object will be added in its place.

To hook this other object in, override make_object(added_class, name, **attrs) and maybe set_object(added_class, name, **attrs) (the default implementation of set_object just resets the attribute to whatever make_object returned).

Also see BoundFactory.

This class contains 16 members.

C BoundFactory(...) ...

This will bind the attribute to whatever is given by factory_class. This factory should be a callable with the signature factory_class(added_class, attr_name, *args, **kw).

The factory will be reinvoked (and the attribute rebound) for every subclassing.

This class contains 17 members.

See the source for more information.