当前位置: 首页>>代码示例>>Python>>正文


Python Session.remove方法代码示例

本文整理汇总了Python中kallithea.model.meta.Session.remove方法的典型用法代码示例。如果您正苦于以下问题:Python Session.remove方法的具体用法?Python Session.remove怎么用?Python Session.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kallithea.model.meta.Session的用法示例。


在下文中一共展示了Session.remove方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_method

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
    def setup_method(self, method):
        Session.remove()
        u1 = UserModel().create_or_update(username=u'u1',
                                        password=u'qweqwe',
                                        email=u'[email protected]',
                                        firstname=u'u1', lastname=u'u1')
        Session().commit()
        self.u1 = u1.user_id

        u2 = UserModel().create_or_update(username=u'u2',
                                        password=u'qweqwe',
                                        email=u'[email protected]',
                                        firstname=u'u2', lastname=u'u3')
        Session().commit()
        self.u2 = u2.user_id

        u3 = UserModel().create_or_update(username=u'u3',
                                        password=u'qweqwe',
                                        email=u'[email protected]',
                                        firstname=u'u3', lastname=u'u3')
        Session().commit()
        self.u3 = u3.user_id

        self.remove_all_notifications()
        assert [] == Notification.query().all()
        assert [] == UserNotification.query().all()
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:28,代码来源:test_notifications.py

示例2: test_push_unlocks_repository_git

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
    def test_push_unlocks_repository_git(self, webserver):
        # enable locking
        fork_name = '%s_fork%s' % (GIT_REPO, _RandomNameSequence().next())
        fixture.create_fork(GIT_REPO, fork_name)
        r = Repository.get_by_repo_name(fork_name)
        r.enable_locking = True
        Session().commit()
        #clone some temp
        DEST = _get_tmp_dir()
        clone_url = webserver.repo_url(fork_name)
        stdout, stderr = Command(TESTS_TMP_PATH).execute('git clone', clone_url, DEST)

        #check for lock repo after clone
        r = Repository.get_by_repo_name(fork_name)
        assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id

        #push is ok and repo is now unlocked
        stdout, stderr = _add_files_and_push(webserver, 'git', DEST, clone_url=clone_url)
        _check_proper_git_push(stdout, stderr)

        assert ('remote: Released lock on repo `%s`' % fork_name) in stderr
        #we need to cleanup the Session Here !
        Session.remove()
        r = Repository.get_by_repo_name(fork_name)
        assert r.locked == [None, None]
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:27,代码来源:test_vcs_operations.py

示例3: teardown_method

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
 def teardown_method(self, method):
     if self.r2_id:
         RepoModel().delete(self.r2_id)
     if self.r1_id:
         RepoModel().delete(self.r1_id)
     Session().commit()
     Session.remove()
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:9,代码来源:test_compare.py

示例4: teardown_method

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
    def teardown_method(self, method):
        perm = Permission.query().all()
        for p in perm:
            UserModel().revoke_perm(self.u1, p)

        UserModel().delete(self.u1)
        Session().commit()
        Session.remove()
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:10,代码来源:test_users.py

示例5: _destroy_project_tree

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def _destroy_project_tree(test_u1_id):
    Session.remove()
    repo_group = RepoGroup.get_by_group_name(group_name='g0')
    for el in reversed(repo_group.recursive_groups_and_repos()):
        if isinstance(el, Repository):
            RepoModel().delete(el)
        elif isinstance(el, RepoGroup):
            RepoGroupModel().delete(el, force_delete=True)

    u = User.get(test_u1_id)
    Session().delete(u)
    Session().commit()
开发者ID:msabramo,项目名称:kallithea,代码行数:14,代码来源:common.py

示例6: teardown_class

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
    def teardown_class(cls):
        # delete in reversed order, to delete fork destination at first
        for reponame, init_or_fork, groupname in reversed(repos):
            RepoModel().delete(repoids[reponame])

        for reponame, init_or_fork, groupname in reversed(repos):
            if groupname in groupids:
                RepoGroupModel().delete(groupids.pop(groupname),
                                        force_delete=True)

        Session().commit()
        Session.remove()

        rebuild_index(full_index=True) # rebuild fully for subsequent tests
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:16,代码来源:test_search_indexing.py

示例7: set_available_permissions

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
def set_available_permissions(config):
    """
    This function will propagate globals with all available defined
    permission given in db. We don't want to check each time from db for new
    permissions since adding a new permission also requires application restart
    ie. to decorate new views with the newly created permission

    :param config: current config instance

    """
    log.info('getting information about all available permissions')
    try:
        all_perms = Session().query(Permission).all()
        config['available_permissions'] = [x.permission_name for x in all_perms]
    finally:
        Session.remove()
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:18,代码来源:auth.py

示例8: test_push_unlocks_repository_hg

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
    def test_push_unlocks_repository_hg(self):
        # enable locking
        r = Repository.get_by_repo_name(HG_REPO)
        r.enable_locking = True
        Session().add(r)
        Session().commit()
        #clone some temp
        DEST = _get_tmp_dir()
        clone_url = _construct_url(HG_REPO, dest=DEST)
        stdout, stderr = Command('/tmp').execute('hg clone', clone_url)

        #check for lock repo after clone
        r = Repository.get_by_repo_name(HG_REPO)
        uid = User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
        assert r.locked[0] == uid

        #push is ok and repo is now unlocked
        stdout, stderr = _add_files_and_push('hg', DEST)
        assert ('remote: Released lock on repo `%s`' % HG_REPO) in stdout
        #we need to cleanup the Session Here !
        Session.remove()
        r = Repository.get_by_repo_name(HG_REPO)
        assert r.locked == [None, None]
开发者ID:zhumengyuan,项目名称:kallithea,代码行数:25,代码来源:manual_test_vcs_operations.py

示例9: __init__

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
    def __init__(self, methodName='runTest'):
        Session.remove()
        self.u1 = UserModel().create_or_update(username=u'u1',
                                        password=u'qweqwe',
                                        email=u'[email protected]',
                                        firstname=u'u1', lastname=u'u1')
        Session().commit()
        self.u1 = self.u1.user_id

        self.u2 = UserModel().create_or_update(username=u'u2',
                                        password=u'qweqwe',
                                        email=u'[email protected]',
                                        firstname=u'u2', lastname=u'u3')
        Session().commit()
        self.u2 = self.u2.user_id

        self.u3 = UserModel().create_or_update(username=u'u3',
                                        password=u'qweqwe',
                                        email=u'[email protected]',
                                        firstname=u'u3', lastname=u'u3')
        Session().commit()
        self.u3 = self.u3.user_id

        super(TestNotifications, self).__init__(methodName=methodName)
开发者ID:msabramo,项目名称:kallithea,代码行数:26,代码来源:test_notifications.py

示例10: setup_class

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
 def setup_class(cls):
     Session.remove()
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:4,代码来源:test_users.py

示例11: tearDown

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
 def tearDown(self):
     fixture.destroy_repo('main')
     Session.commit()
     Session.remove()
开发者ID:msabramo,项目名称:kallithea,代码行数:6,代码来源:test_pullrequests.py

示例12: __init__

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import remove [as 别名]
 def __init__(self, methodName='runTest'):
     Session.remove()
     super(TestUser, self).__init__(methodName=methodName)
开发者ID:msabramo,项目名称:kallithea,代码行数:5,代码来源:test_users.py


注:本文中的kallithea.model.meta.Session.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。