Session.call takes in kwargs instead of args

This commit is contained in:
moyamo 2015-02-27 19:28:36 +02:00
parent e9f40dbed9
commit 97c3aba3ec

View file

@ -104,10 +104,10 @@ class Session():
def __del__(self): # handleLogoutRequest def __del__(self): # handleLogoutRequest
self.logout() self.logout()
def call(self, method, args = ()): def call(self, method, **kwargs):
args = [str(s) for s in args] self.logger.debug("%s(%s)", method,
self.logger.debug("%s(%s)", method, ", ".join(args)) ", ".join(str(k) + ': ' + str(v) for k, v in kwargs.items()))
self.stack.broadcastEvent(YowLayerEvent(method, **args)) self.stack.broadcastEvent(YowLayerEvent(method, **kwargs))
def logout(self): def logout(self):
self.stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_DISCONNECT)) self.stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_DISCONNECT))