allura.lib.decorators

class allura.lib.decorators.event_handler(*topics)

Decorator to register event handlers

allura.lib.decorators.getattr_(obj, name, default_thunk)

Similar to .setdefault in dictionaries.

allura.lib.decorators.memoize(func)

Cache the method’s result, for the given args

allura.lib.decorators.reconfirm_auth(func)

A decorator to require the user to reconfirm their login. Useful for sensitive pages.

class allura.lib.decorators.require_post(redir=None)

A decorator to require controllers by accessed with a POST only. Use whenever data will be modified by a controller, since that’s what POST is good for. We have CSRF protection middleware on POSTs, too.

allura.lib.decorators.task(*args, **kw)

Decorator that adds a .post() function to the decorated callable.

Calling <original_callable>.post(*args, **kw) queues the callable for execution by a background worker process. All parameters must be BSON-serializable.

Example usage:

@task
def myfunc():
    pass

@task(notifications_disabled=True)
def myotherfunc():
    # No email notifications will be sent for c.project during this task
    pass