AOP modules

aop – declarative transactions and sessions

Provides summer AOP functionality.

You can find here most useful decorators transactional() for SQL transaction support and ldapaop().

summer.aop.transactional(method: function) → function[source]

Method decorator marking method to be transactional.

Every decorated method behaves as follows:

  • if no transaction is active and database is not in autocommit mode, start a new transaction, doing commit/rollback at the end

  • if there is a transaction, just simple continue within the transaction without doing commit/rollback at the end (that is left to the top-most transactional method)

Parameters

method (types.FunctionType) – function to be decorated

Returns

decorated function

Return type

(types.FunctionType)

summer.aop.ldapaop(method: function) → function[source]

Method decorator marking method to be run in LDAP session. Analogy to summer.aop.transactional() with same logic.

Intended use case for this decorator is to decorate summer.ldapdao.LdapEntityDao methods and then access current ldap3 session/connection by using summer.ldapdao.LdapDao.session from within the DAO method. Thus you can access ldap3 session/connection (and manipulate data), and still have the transaction boundaries defined on top of your business methods.

Parameters

method (types.FunctionType) – function to be decorated

Returns

decorated function

Return type

(types.FunctionType)