def delete(cls, users_group_id): try: # check if this group is not assigned to repo assigned_groups = ( UsersGroupRepoToPerm.query().filter(UsersGroupRepoToPerm.users_group_id == users_group_id).all() ) if assigned_groups: raise UsersGroupsAssignedException("RepoGroup assigned to %s" % assigned_groups) users_group = cls.get(users_group_id, cache=False) Session.delete(users_group) Session.commit() except: log.error(traceback.format_exc()) Session.rollback() raise
def delete(cls, user_group_id): try: # check if this group is not assigned to repo assigned_groups = UserGroupRepoToPerm.query()\ .filter(UserGroupRepoToPerm.users_group_id == user_group_id).all() if assigned_groups: raise UserGroupAssignedException( 'UserGroup assigned to %s' % assigned_groups) users_group = cls.get(user_group_id, cache=False) Session.delete(users_group) Session.commit() except: log.error(traceback.format_exc()) Session.rollback() raise
def _clean_notifications(self): for n in Notification.query().all(): Session.delete(n) Session.commit() self.assertEqual(Notification.query().all(), [])
def delete(cls, id_): obj = cls.query().get(id_) Session.delete(obj)
def delete_user_permission(self, repository, user): current = self.get_user_permission(repository, user) if current: Session.delete(current) Session.commit()
def delete(cls, id_): obj = cls.query().get(id_) Session.delete(obj) Session.commit()
def tearDown(self): for n in Notification.query().all(): Session.delete(n) Session.commit() self.assertEqual(Notification.query().all(), [])
def delete(cls, id_): obj = Session.query(cls).get(id_) Session.delete(obj) Session.commit()
def tearDown(self): for n in Notification.query().all(): inst = Notification.get(n.notification_id) Session.delete(inst) Session.commit()