當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。