Add the augment_method_from decorator for augmenting existing functions.

Review Request #1746 — Created Aug. 22, 2010 and submitted

chipx86
Djblets
master
djblets
Add the augment_method_from decorator for augmenting existing functions.

This decorator allows a subclass to augment a parent class's function's
documentation and decorators. The existing decorators are automatically
inherited. Where this becomes useful is where you have several classes
that share common logic, but may need further restrictions or new documentation.

An example is the webapi resource classes, where the base functions already
perform the necessary logic and have appropriate default decorators, but
subclasses would want to provide new documentation and potentially new
decorators to limit access or return new metadata.

The defined function is meant to have an empty body (or 'pass'), but it can
contain code which will be executed after the parent function. No returned
values will be used, however.
Used this extensively in my Review Board doc generation change.
Loading...