def __call__(self, function, *args, **kwargs):
if self.do_quit_check:<EOL><INDENT>self.quit_check()<EOL><DEDENT>with self.db_conn_context_source() as connection:<EOL><INDENT>try:<EOL><INDENT>result = function(connection, *args, **kwargs)<EOL>connection.commit()<EOL>return result<EOL><DEDENT>except DBApiUtilNonFatalBaseException:<EOL><INDENT>connection.rollback()<EOL>raise<EOL><DEDENT>except BaseException as x:<EOL><INDENT>connection.rollback()<EOL>self.config.logger.error(<EOL>'<STR_LIT>',<EOL>self.connection_source_type,<EOL>exc_info=True)<EOL>self.db_conn_context_source.force_reconnect()<EOL>raise<EOL><DEDENT><DEDENT>
execute a function within the context of a transaction