This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Lightweight Aspect-oriented Module for Python

Project Description

Hooks advice to a function or method.

advise() is a decorator that takes a set of functions or methods and injects the decorated function in their place. There is no concept of before/after callbacks. Instead, the intercepting function is responsible for calling (or not) the intercepted function.

The “classic” logging example:

class A(object):
  def a_function(self):
    print 'a_function()'

@advise(A.a_function)
def logit(on, next, *args, **kwargs):
  logging.debug('%r.%r(%r, %r)', on, next, args, kwargs)
  return next(*args, **kwargs)

See the function documentation for more information.

Release History

Release History

This version
History Node

0.0.1

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting