本文整理匯總了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))
示例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,)