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


Python RepoGroup.get_by_group_name方法代码示例

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


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

示例1: create_repo_group

# 需要导入模块: from kallithea.model.db import RepoGroup [as 别名]
# 或者: from kallithea.model.db.RepoGroup import get_by_group_name [as 别名]
 def create_repo_group(self, name, **kwargs):
     if 'skip_if_exists' in kwargs:
         del kwargs['skip_if_exists']
         gr = RepoGroup.get_by_group_name(group_name=name)
         if gr:
             return gr
     form_data = self._get_group_create_params(group_name=name, **kwargs)
     owner = kwargs.get('cur_user', TEST_USER_ADMIN_LOGIN)
     gr = RepoGroupModel().create(
         group_name=form_data['group_name'],
         group_description=form_data['group_name'],
         owner=owner, parent=form_data['group_parent_id'])
     Session().commit()
     gr = RepoGroup.get_by_group_name(gr.group_name)
     return gr
开发者ID:msabramo,项目名称:kallithea,代码行数:17,代码来源:fixture.py

示例2: permissions_setup_func

# 需要导入模块: from kallithea.model.db import RepoGroup [as 别名]
# 或者: from kallithea.model.db.RepoGroup import get_by_group_name [as 别名]
def permissions_setup_func(group_name='g0', perm='group.read', recursive='all',
                           user_id=None):
    """
    Resets all permissions to perm attribute
    """
    if not user_id:
        user_id = test_u1_id
        permissions_setup_func(group_name, perm, recursive,
                               user_id=User.get_default_user().user_id)

    repo_group = RepoGroup.get_by_group_name(group_name=group_name)
    if not repo_group:
        raise Exception('Cannot get group %s' % group_name)

    # Start with a baseline that current group can read recursive
    perms_updates = [[user_id, 'group.read', 'user']]
    RepoGroupModel()._update_permissions(repo_group,
                                         perms_updates=perms_updates,
                                         recursive='all', check_perms=False)

    perms_updates = [[user_id, perm, 'user']]
    RepoGroupModel()._update_permissions(repo_group,
                                         perms_updates=perms_updates,
                                         recursive=recursive, check_perms=False)
    Session().commit()
开发者ID:zhumengyuan,项目名称:kallithea,代码行数:27,代码来源:test_user_permissions_on_repo_groups.py

示例3: test_update_group_parent

# 需要导入模块: from kallithea.model.db import RepoGroup [as 别名]
# 或者: from kallithea.model.db.RepoGroup import get_by_group_name [as 别名]
    def test_update_group_parent(self):

        sg1 = fixture.create_repo_group(u'initial', parent_group_id=self.g1.group_id)

        new_sg1 = _update_repo_group(sg1.group_id, u'after', parent_id=self.g1.group_id)
        assert self.__check_path('test1', 'after')
        assert RepoGroup.get_by_group_name(u'test1/initial') == None

        new_sg1 = _update_repo_group(sg1.group_id, u'after', parent_id=self.g3.group_id)
        assert self.__check_path('test3', 'after')
        assert RepoGroup.get_by_group_name(u'test3/initial') == None

        new_sg1 = _update_repo_group(sg1.group_id, u'hello')
        assert self.__check_path('hello')

        assert RepoGroup.get_by_group_name(u'hello') == new_sg1
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:18,代码来源:test_repo_groups.py

示例4: show_by_name

# 需要导入模块: from kallithea.model.db import RepoGroup [as 别名]
# 或者: from kallithea.model.db.RepoGroup import get_by_group_name [as 别名]
 def show_by_name(self, group_name):
     """
     This is a proxy that does a lookup group_name -> id, and shows
     the group by id view instead
     """
     group_name = group_name.rstrip('/')
     id_ = RepoGroup.get_by_group_name(group_name)
     if id_:
         return self.show(group_name)
     raise HTTPNotFound
开发者ID:zhumengyuan,项目名称:kallithea,代码行数:12,代码来源:repo_groups.py

示例5: _destroy_project_tree

# 需要导入模块: from kallithea.model.db import RepoGroup [as 别名]
# 或者: from kallithea.model.db.RepoGroup import get_by_group_name [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: permissions_setup_func

# 需要导入模块: from kallithea.model.db import RepoGroup [as 别名]
# 或者: from kallithea.model.db.RepoGroup import get_by_group_name [as 别名]
def permissions_setup_func(group_name='g0', perm='group.read', recursive='all',
                           user_id=None):
    """
    Resets all permissions to perm attribute
    """
    if not user_id:
        user_id = test_u1_id
        # called by the @with_setup decorator also reset the default user stuff
        permissions_setup_func(group_name, perm, recursive,
                               user_id=User.get_default_user().user_id)

    repo_group = RepoGroup.get_by_group_name(group_name=group_name)
    if not repo_group:
        raise Exception('Cannot get group %s' % group_name)

    perms_updates = [[user_id, perm, 'user']]
    RepoGroupModel()._update_permissions(repo_group,
                                         perms_updates=perms_updates,
                                         recursive=recursive, check_perms=False)
    Session().commit()
开发者ID:msabramo,项目名称:kallithea,代码行数:22,代码来源:test_user_permissions_on_repo_groups.py

示例7: validate_python

# 需要导入模块: from kallithea.model.db import RepoGroup [as 别名]
# 或者: from kallithea.model.db.RepoGroup import get_by_group_name [as 别名]
        def validate_python(self, value, state):

            repo_name = value.get('repo_name')
            repo_name_full = value.get('repo_name_full')
            group_path = value.get('group_path')
            group_name = value.get('group_name')

            if repo_name in [ADMIN_PREFIX, '']:
                msg = M(self, 'invalid_repo_name', state, repo=repo_name)
                raise formencode.Invalid(msg, value, state,
                    error_dict=dict(repo_name=msg)
                )

            rename = old_data.get('repo_name') != repo_name_full
            create = not edit
            if rename or create:

                if group_path != '':
                    if Repository.get_by_repo_name(repo_name_full):
                        msg = M(self, 'repository_in_group_exists', state,
                                repo=repo_name, group=group_name)
                        raise formencode.Invalid(msg, value, state,
                            error_dict=dict(repo_name=msg)
                        )
                elif RepoGroup.get_by_group_name(repo_name_full):
                        msg = M(self, 'same_group_exists', state,
                                repo=repo_name)
                        raise formencode.Invalid(msg, value, state,
                            error_dict=dict(repo_name=msg)
                        )

                elif Repository.get_by_repo_name(repo_name_full):
                        msg = M(self, 'repository_exists', state,
                                repo=repo_name)
                        raise formencode.Invalid(msg, value, state,
                            error_dict=dict(repo_name=msg)
                        )
            return value
开发者ID:msabramo,项目名称:kallithea,代码行数:40,代码来源:validators.py

示例8: test_rename_single_group

# 需要导入模块: from kallithea.model.db import RepoGroup [as 别名]
# 或者: from kallithea.model.db.RepoGroup import get_by_group_name [as 别名]
    def test_rename_single_group(self):
        sg1 = fixture.create_repo_group(u'initial')

        new_sg1 = _update_repo_group(sg1.group_id, u'after')
        assert self.__check_path('after')
        assert RepoGroup.get_by_group_name(u'initial') == None
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:8,代码来源:test_repo_groups.py

示例9: expected_count

# 需要导入模块: from kallithea.model.db import RepoGroup [as 别名]
# 或者: from kallithea.model.db.RepoGroup import get_by_group_name [as 别名]
def expected_count(group_name, objects=False):
    repo_group = RepoGroup.get_by_group_name(group_name=group_name)
    objs = repo_group.recursive_groups_and_repos()
    if objects:
        return objs
    return len(objs)
开发者ID:msabramo,项目名称:kallithea,代码行数:8,代码来源:common.py


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