Skip to content
Permalink
Browse files
除去不需要的default参数,贴合业务使用
  • Loading branch information
JoeCao committed Apr 12, 2015
1 parent af62d89 commit 89136a62d9290507f0eefb0e158cafaf9a047d10
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
@@ -119,7 +119,7 @@ def subscribe(self, interface, **kwargs):
# 全部重新添加
self.__handler_nodes(interface, children)

def get_provides(self, interface, default=None, **kwargs):
def get_provides(self, interface, **kwargs):
"""
获取已经注册的服务URL对象
:param interface: com.ofpay.demo.api.UserProvider
@@ -130,7 +130,7 @@ def get_provides(self, interface, default=None, **kwargs):
version = kwargs.get('version', '')
key = self.__to_key(interface, version, group)
second = self.__service_provides.get(interface, {})
return second.get(key, default)
return second.get(key, {})


if __name__ == '__main__':
@@ -32,7 +32,7 @@ def __init__(self, interface, registry, **kwargs):
self.registry.subscribe(interface)

def call(self, method, *args, **kwargs):
provides = self.registry.get_provides(self.interface, {}, version=self.version, group=self.group)
provides = self.registry.get_provides(self.interface, version=self.version, group=self.group)
if len(provides) == 0:
raise NoProvider('can not find provide', self.interface)
ip_port, service_url = random.choice(provides.items())

0 comments on commit 89136a6

Please sign in to comment.