def _nested_transactional(fn):<EOL>
@wraps(fn)<EOL>def wrapped(self, *args, **kwargs):<EOL><INDENT>try:<EOL><INDENT>rv = fn(self, *args, **kwargs)<EOL><DEDENT>except _TransactionalPolicyViolationError as e:<EOL><INDENT>getattr(self, _TX_HOLDER_ATTRIBUTE).rollback()<EOL>rv = e.result<EOL><DEDENT>return rv<EOL><DEDENT>return wrapped<EOL>
In a transactional method create a nested transaction.