This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: improve telnetlib.Telnet so option negotiation becomes easie
Type: enhancement Stage: test needed
Components: Library (Lib) Versions: Python 3.4
Status: open Resolution:
Dependencies: Superseder:
Assigned To: jackdied Nosy List: jackdied, jimjjewett, sonderblade
Priority: normal Keywords: patch

Created on 2007-03-10 22:11 by sonderblade, last changed 2022-04-11 14:56 by admin.

File name Uploaded Description Edit
telnetlib-add-handle-option.patch sonderblade, 2007-03-10 22:11 review
Messages (4)
msg52166 - (view) Author: Björn Lindqvist (sonderblade) Date: 2007-03-10 22:11
This patch is a merger of #664020 (telnetlib option subnegotiation fix) and #1520081 ( change to ease option handling) which are both outdated.

The purpose of it is to replace the set_option_negotiation_callback with a handle_option method that subclasses can reimplement. This should make it much easier to implement custom option negotiation handling. The patch also extends the documentation somewhat to make it clearer how to to implement custom option subnegotiation.

It breaks compatibility with earlier Pythons because it removes set_option_negotiation_callback. But I think it should be good to apply it for Python 3.0. See the referenced patches for many more details.
msg52167 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-17 21:47
Closed the other two patches as "superseded by this one".
msg52168 - (view) Author: Jim Jewett (jimjjewett) Date: 2007-03-19 01:04
(1)  In the example code, why is parms backquoted?  My first thought was that it was for repr, which won't work in Py3, particularly since it isn't quoted on the previous line.

+            parms = self.read_sb_data()
+            self.msg('IAC SB %d %s IAC SE', ord(opt), `parms`)

(2)  There are advantages to the old callback way.  It is easier to change things per-instance, at runtime, and even mid-connection.  It might be worth showing an example that restores the current model.

    option_callback=None # class default
    def set_option_negotiation_callback(self, callback):
        """Provide a callback function called after each receipt of a telnet option."""
        self.option_callback = callback

    def handle_option(self, command, option):
        if self.option_callback is not None:
            return self.option_callback(self, command, option)

msg85039 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-04-01 16:21
assigning all open telnetlib items to myself
Date User Action Args
2022-04-11 14:56:23adminsetgithub: 44693
2020-09-19 19:04:48georg.brandlsetnosy: - georg.brandl
2012-11-18 20:01:26ezio.melottisetversions: + Python 3.4, - Python 3.2
2010-09-16 22:19:42BreamoreBoysetnosy: georg.brandl, jimjjewett, sonderblade, jackdied
versions: + Python 3.2, - Python 3.0
type: enhancement
components: + Library (Lib), - None
stage: test needed
2009-04-01 16:21:54jackdiedsetassignee: jackdied

messages: + msg85039
nosy: + jackdied
2008-01-06 22:29:46adminsetkeywords: - py3k
versions: Python 3.0
2007-08-30 00:22:03gvanrossumsetversions: + Python 3.0
2007-03-10 22:11:38sonderbladecreate