本文整理汇总了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,)