'Rolls back changes if the system is not in managed transaction mode.'

def rollback_unless_managed(self):

    self.validate_thread_sharing()
    if (not self.is_managed()):
        self._rollback()
    else:
        self.set_dirty()
