Clarify documentation and method name
This commit is contained in:
parent
49eb2b2873
commit
dcb029e5ff
2 changed files with 4 additions and 4 deletions
|
|
@ -243,7 +243,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
line (str): Line to send.
|
line (str): Line to send.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
line = self.try_encode(line)
|
line = self.encode_output(line)
|
||||||
# escape IAC in line mode, and correctly add \r\n (the TELNET end-of-line)
|
# escape IAC in line mode, and correctly add \r\n (the TELNET end-of-line)
|
||||||
line = line.replace(IAC, IAC + IAC)
|
line = line.replace(IAC, IAC + IAC)
|
||||||
line = line.replace(b'\n', b'\r\n')
|
line = line.replace(b'\n', b'\r\n')
|
||||||
|
|
@ -343,7 +343,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
strip_ansi=nocolor, xterm256=xterm256)
|
strip_ansi=nocolor, xterm256=xterm256)
|
||||||
if mxp:
|
if mxp:
|
||||||
prompt = mxp_parse(prompt)
|
prompt = mxp_parse(prompt)
|
||||||
prompt = self.try_encode(prompt)
|
prompt = self.encode_output(prompt)
|
||||||
prompt = prompt.replace(IAC, IAC + IAC).replace(b'\n', b'\r\n')
|
prompt = prompt.replace(IAC, IAC + IAC).replace(b'\n', b'\r\n')
|
||||||
prompt += IAC + GA
|
prompt += IAC + GA
|
||||||
self.transport.write(mccp_compress(self, prompt))
|
self.transport.write(mccp_compress(self, prompt))
|
||||||
|
|
|
||||||
|
|
@ -137,9 +137,9 @@ class Session(object):
|
||||||
|
|
||||||
# helpers
|
# helpers
|
||||||
|
|
||||||
def try_encode(self, text):
|
def encode_output(self, text):
|
||||||
"""
|
"""
|
||||||
Try to encode the given text, following the session's protocol flag.
|
Encode the given text for output, following the session's protocol flag.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
text (str or bytes): the text to encode to bytes.
|
text (str or bytes): the text to encode to bytes.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue