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


Python Setting.get_default_repo_settings方法代码示例

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


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

示例1: index

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_default_repo_settings [as 别名]
    def index(self, format='html'):
        c.backends = BACKENDS.keys()
        defaults = Setting.get_default_repo_settings()

        return htmlfill.render(
            render('admin/defaults/defaults.html'),
            defaults=defaults,
            encoding="UTF-8",
            force_defaults=False
        )
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:12,代码来源:defaults.py

示例2: test_update_params_false_git

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_default_repo_settings [as 别名]
 def test_update_params_false_git(self):
     self.log_user()
     params = {
         'default_repo_enable_locking': False,
         'default_repo_enable_downloads': False,
         'default_repo_enable_statistics': False,
         'default_repo_private': False,
         'default_repo_type': 'git',
     }
     response = self.app.put(url('default', id='default'), params=params)
     self.checkSessionFlash(response, 'Default settings updated successfully')
     defs = Setting.get_default_repo_settings()
     self.assertEqual(params, defs)
开发者ID:msabramo,项目名称:kallithea,代码行数:15,代码来源:test_admin_defaults.py

示例3: create_repository

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_default_repo_settings [as 别名]
    def create_repository(self):
        self.__load_defaults()
        if not c.repo_groups:
            raise HTTPForbidden
        parent_group = request.GET.get('parent_group')

        ## apply the defaults from defaults page
        defaults = Setting.get_default_repo_settings(strip_prefix=True)
        if parent_group:
            prg = RepoGroup.get(parent_group)
            if prg is None or not any(rgc[0] == prg.group_id
                                      for rgc in c.repo_groups):
                raise HTTPForbidden
            defaults.update({'repo_group': parent_group})

        return htmlfill.render(
            render('admin/repos/repo_add.html'),
            defaults=defaults,
            errors={},
            prefix_error=False,
            encoding="UTF-8",
            force_defaults=False)
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:24,代码来源:repos.py

示例4: create_repository

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_default_repo_settings [as 别名]
    def create_repository(self):
        """GET /_admin/create_repository: Form to create a new item"""
        new_repo = request.GET.get('repo', '')
        parent_group = request.GET.get('parent_group')
        if not HasPermissionAny('hg.admin', 'hg.create.repository')():
            #you're not super admin nor have global create permissions,
            #but maybe you have at least write permission to a parent group ?
            _gr = RepoGroup.get(parent_group)
            gr_name = _gr.group_name if _gr else None
            # create repositories with write permission on group is set to true
            create_on_write = HasPermissionAny('hg.create.write_on_repogroup.true')()
            group_admin = HasRepoGroupPermissionAny('group.admin')(group_name=gr_name)
            group_write = HasRepoGroupPermissionAny('group.write')(group_name=gr_name)
            if not (group_admin or (group_write and create_on_write)):
                raise HTTPForbidden

        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)
        choices, c.landing_revs = ScmModel().get_repo_landing_revs()

        c.new_repo = repo_name_slug(new_repo)

        ## apply the defaults from defaults page
        defaults = Setting.get_default_repo_settings(strip_prefix=True)
        if parent_group:
            defaults.update({'repo_group': parent_group})

        return htmlfill.render(
            render('admin/repos/repo_add.html'),
            defaults=defaults,
            errors={},
            prefix_error=False,
            encoding="UTF-8",
            force_defaults=False)
开发者ID:zhumengyuan,项目名称:kallithea,代码行数:38,代码来源:repos.py


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