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


Python Zone.lookupByName方法代码示例

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


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

示例1: _getSession

# 需要导入模块: from Zone import Zone [as 别名]
# 或者: from Zone.Zone import lookupByName [as 别名]
    def _getSession(self, client_stream, client_local, client_listen, client_address):
        """<method internal="yes">
        </method>
        """
        result = getKZorpResult(client_address.family, client_stream.fd)
        if result is None:
            ## LOG ##
            # This message indicates that the KZorp result
            # lookup has failed for this session.
            ##
            log(None, CORE_POLICY, 0, "Unable to determine service, KZorp service lookup failed; bindto='%s'", (self.bindto[0], ))
            return None

        (client_zone_name, server_zone_name, dispatcher_name, service_name, rule_id) = result
        service = Globals.services.get(service_name)
        client_zone = Zone.lookupByName(client_zone_name)
        server_zone = Zone.lookupByName(server_zone_name)

        return MasterSession(service, client_stream, client_local, client_listen, client_address,
                             client_zone = client_zone, server_zone = server_zone, rule_id = rule_id, instance_id=getInstanceId(service.name))
开发者ID:mochrul,项目名称:zorp,代码行数:22,代码来源:Dispatch.py

示例2: resolveZones

# 需要导入模块: from Zone import Zone [as 别名]
# 或者: from Zone.Zone import lookupByName [as 别名]
        def resolveZones(name_list):
            """
            <method internal="yes">
            Helper function to convert a list of zone
            names to a list of Zone instnaces
            </method>
            """
            name_list = makeSequence(name_list)

            for name in name_list:
                if Zone.lookupByName(name) == None:
                    raise ValueError, "No zone was defined with that name; zone='%s'" % (name,)
开发者ID:Balasys,项目名称:zorp,代码行数:14,代码来源:Rule.py


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