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


Python Setting.get_by_name方法代码示例

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


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

示例1: get_managed_fields

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_by_name [as 别名]
 def get_managed_fields(self):
     fields = ['username', 'password']
     if(Setting.get_by_name('auth_container_email_header').app_settings_value):
         fields.append('email')
     if(Setting.get_by_name('auth_container_firstname_header').app_settings_value):
         fields.append('firstname')
     if(Setting.get_by_name('auth_container_lastname_header').app_settings_value):
         fields.append('lastname')
     return fields
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:11,代码来源:auth_container.py

示例2: __render

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_by_name [as 别名]
    def __render(self, defaults, errors):
        c.defaults = {}
        c.plugin_settings = {}
        c.plugin_shortnames = {}

        for plugin in self.enabled_plugins:
            module = plugin.__class__.__module__
            c.plugin_shortnames[module] = plugin.name
            c.plugin_settings[module] = plugin.plugin_settings()
            for v in c.plugin_settings[module]:
                fullname = "auth_%s_%s" % (plugin.name, v["name"])
                if "default" in v:
                    c.defaults[fullname] = v["default"]
                # Current values will be the default on the form, if there are any
                setting = Setting.get_by_name(fullname)
                if setting is not None:
                    c.defaults[fullname] = setting.app_settings_value
        # we want to show , separated list of enabled plugins
        c.defaults['auth_plugins'] = ','.join(c.enabled_plugin_names)

        if defaults:
            c.defaults.update(defaults)

        log.debug(formatted_json(defaults))
        return formencode.htmlfill.render(
            render('admin/auth/auth_settings.html'),
            defaults=c.defaults,
            errors=errors,
            prefix_error=False,
            encoding="UTF-8",
            force_defaults=False)
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:33,代码来源:auth_settings.py

示例3: get_settings

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_by_name [as 别名]
 def get_settings(self):
     """Get plugin settings values."""
     plugin_settings = {}
     for v in self.plugin_settings():
         conf_key = "auth_%s_%s" % (self.name, v["name"])
         setting = Setting.get_by_name(conf_key)
         plugin_settings[v["name"]] = setting.app_settings_value if setting else None
     return plugin_settings
开发者ID:andrewshadura,项目名称:kallithea-auth-google,代码行数:10,代码来源:auth_google.py

示例4: create_auth_plugin_options

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_by_name [as 别名]
    def create_auth_plugin_options(self, skip_existing=False):
        """
        Create default auth plugin settings, and make it active

        :param skip_existing:
        """

        for k, v, t in [('auth_plugins', 'kallithea.lib.auth_modules.auth_internal', 'list'),
                     ('auth_internal_enabled', 'True', 'bool')]:
            if skip_existing and Setting.get_by_name(k) != None:
                log.debug('Skipping option %s' % k)
                continue
            setting = Setting(k, v, t)
            self.sa.add(setting)
开发者ID:msabramo,项目名称:kallithea,代码行数:16,代码来源:db_manage.py

示例5: create_default_options

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_by_name [as 别名]
    def create_default_options(self, skip_existing=False):
        """Creates default settings"""

        for k, v, t in [
            ('default_repo_enable_locking',  False, 'bool'),
            ('default_repo_enable_downloads', False, 'bool'),
            ('default_repo_enable_statistics', False, 'bool'),
            ('default_repo_private', False, 'bool'),
            ('default_repo_type', 'hg', 'unicode')]:

            if skip_existing and Setting.get_by_name(k) is not None:
                log.debug('Skipping option %s' % k)
                continue
            setting = Setting(k, v, t)
            self.sa.add(setting)
开发者ID:msabramo,项目名称:kallithea,代码行数:17,代码来源:db_manage.py

示例6: index

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_by_name [as 别名]
    def index(self, defaults=None, errors=None, prefix_error=False):
        self.__load_defaults()
        _defaults = {}
        # default plugins loaded
        formglobals = {
            "auth_plugins": ["kallithea.lib.auth_modules.auth_internal"]
        }
        formglobals.update(Setting.get_auth_settings())
        formglobals["plugin_settings"] = {}
        formglobals["auth_plugins_shortnames"] = {}
        _defaults["auth_plugins"] = formglobals["auth_plugins"]

        for module in formglobals["auth_plugins"]:
            plugin = auth_modules.loadplugin(module)
            plugin_name = plugin.name
            formglobals["auth_plugins_shortnames"][module] = plugin_name
            formglobals["plugin_settings"][module] = plugin.plugin_settings()
            for v in formglobals["plugin_settings"][module]:
                fullname = ("auth_" + plugin_name + "_" + v["name"])
                if "default" in v:
                    _defaults[fullname] = v["default"]
                # Current values will be the default on the form, if there are any
                setting = Setting.get_by_name(fullname)
                if setting:
                    _defaults[fullname] = setting.app_settings_value
        # we want to show , separated list of enabled plugins
        _defaults['auth_plugins'] = ','.join(_defaults['auth_plugins'])
        if defaults:
            _defaults.update(defaults)

        formglobals["defaults"] = _defaults
        # set template context variables
        for k, v in formglobals.iteritems():
            setattr(c, k, v)

        log.debug(pprint.pformat(formglobals, indent=4))
        log.debug(formatted_json(defaults))
        return formencode.htmlfill.render(
            render('admin/auth/auth_settings.html'),
            defaults=_defaults,
            errors=errors,
            prefix_error=prefix_error,
            encoding="UTF-8",
            force_defaults=False)
开发者ID:msabramo,项目名称:kallithea,代码行数:46,代码来源:auth_settings.py


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