本文整理汇总了Python中kallithea.model.db.RepoGroup._generate_choice方法的典型用法代码示例。如果您正苦于以下问题:Python RepoGroup._generate_choice方法的具体用法?Python RepoGroup._generate_choice怎么用?Python RepoGroup._generate_choice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kallithea.model.db.RepoGroup
的用法示例。
在下文中一共展示了RepoGroup._generate_choice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __load_defaults
# 需要导入模块: from kallithea.model.db import RepoGroup [as 别名]
# 或者: from kallithea.model.db.RepoGroup import _generate_choice [as 别名]
def __load_defaults(self, repo=None):
acl_groups = RepoGroupList(RepoGroup.query().all(),
perm_set=['group.write', 'group.admin'])
c.repo_groups = RepoGroup.groups_choices(groups=acl_groups)
c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups)
# in case someone no longer have a group.write access to a repository
# pre fill the list with this entry, we don't care if this is the same
# but it will allow saving repo data properly.
repo_group = None
if repo:
repo_group = repo.group
if repo_group and unicode(repo_group.group_id) not in c.repo_groups_choices:
c.repo_groups_choices.append(unicode(repo_group.group_id))
c.repo_groups.append(RepoGroup._generate_choice(repo_group))
choices, c.landing_revs = ScmModel().get_repo_landing_revs()
c.landing_revs_choices = choices