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


Python SettingsBase.get_pending_setting方法代码示例

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


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

示例1: _reenumerate_services

# 需要导入模块: from settings.settings_base import SettingsBase [as 别名]
# 或者: from settings.settings_base.SettingsBase import get_pending_setting [as 别名]
    def _reenumerate_services(self):
        """
        Starts new services found in the pending setting registry's
        "instance_list" setting.

        If a new service is found it determines which driver is needed
        and loads the driver dynamically if it has not been loaded already.
        The instance is then created and started.

        This function does not yet handle the dynamic stopping of system
        services.
        """
        try:
            services = SettingsBase.get_pending_setting(self, "instance_list")
        except:
            # no instances found
            return

        service_names = set()
        for service in services:
            if "driver" in service and "name" in service:
                if service['name'] in service_names:
                    self.__tracer.error("Duplicate item: %s", service['name'])
                    raise KeyError

                if not self._service_loaded(service["driver"]):
                    self.service_load(service["driver"])
                if not self.instance_exists(service["name"]):
                    self.instance_new(service["driver"], service["name"])
                    self.instance_start(service["name"])

                service_names.add(service['name'])
开发者ID:Lewiswight,项目名称:4CT-GW--master,代码行数:34,代码来源:abstract_service_manager.py


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