py-summer aop — py-summer 0.6.0 documentation

# py-summer aop

Basic AOP functionality.

class `summer.aop.` `AbstractMethodAdvice`(method: method)

  Base class for method advice.

  If one wants to use the advice (ie. apply an aspect), the trick is to use the proxy class, that adds another layer of indirection.

  Proxy delegates access to all the attributes to the target object. If the attribute is not decorated, proxy accesses the attribute directly.

  Current implementation supports the creation of an advice in the proxy object by searching for a decoration – if the attribute (method) is decorated by particular decorator, new attribute with the same name is created on the proxy instance (of the type AbstractMethodAdvice) and it gets called instead, doing anything the aspect requires and than delegates the call to target object.

  `after`(*args, **kwargs)

    Implement for after advice.

  `around`(*args, **kwargs)

    Implement for generic around advice. Probably most usefull kind of advice; sure most powerful of advices.

  `before`(*args, **kwargs)

    Implement for before advice.

class `summer.aop.` `AroundMethodAdvice`(method: method)

  Around method advice.

class `summer.aop.` `Proxy`(target: object)

  Generic proxy object proxies the target’s method calls by applying an advice – and so implementing an aspect.