Made some minor updates to the evmenu_login contrib, including adding a max number of password retries before disconnecting as well as fixing how client-exhoes are handled. Also made empty string return rather than 'b'. Also fixed an inconsistency in the Session.msg.

This commit is contained in:
Griatch 2016-04-24 15:10:27 +02:00
parent bf50f5b94a
commit 8bf63885e2
5 changed files with 125 additions and 172 deletions

View file

@ -245,7 +245,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
reason (str): Reason for disconnecting.
"""
self.data_out(connection_close=((reason or "",), {}))
self.data_out(text=((reason or "",), {}))
self.connectionLost(reason)
def data_in(self, **kwargs):
@ -294,7 +294,6 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
Note that it must be actively turned back on again!
"""
#print "telnet.send_text", args,kwargs
text = args[0] if args else ""
if text is None:
return

View file

@ -64,7 +64,7 @@ class WebSocketClient(Protocol, Session):
reason (str): Motivation for the disconnection.
"""
self.data_out(connection_close=((reason or "",), {}))
self.data_out(text=((reason or "",), {}))
self.connectionLost(reason)
def connectionLost(self, reason):

View file

@ -376,7 +376,7 @@ class ServerSession(Session):
for the protocol(s).
"""
if text:
if text is not None:
self.data_out(text=text, **kwargs)
else:
self.data_out(**kwargs)
@ -409,6 +409,7 @@ class ServerSession(Session):
return u"%s" % str(self)
# Dummy API hooks for use during non-loggedin operation
def at_cmdset_get(self, **kwargs):

View file

@ -205,7 +205,6 @@ class SessionHandler(dict):
else:
rkwargs[key] = [ [_validate(data)], {} ]
rkwargs[key][1]["options"] = options
return rkwargs