Patches item #1678077, was opened at 2007-03-10 17:11 Message generated for change (Comment added) made by jimjjewett You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1678077&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: Python 3000 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Bj�rn Lindqvist (sonderblade) Assigned to: Nobody/Anonymous (nobody) Summary: improve telnetlib.Telnet so option negotiation becomes easie Initial Comment: This patch is a merger of #664020 (telnetlib option subnegotiation fix) and #1520081 (telnetlib.py 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. ---------------------------------------------------------------------- Comment By: Jim Jewett (jimjjewett) Date: 2007-03-18 21:04 Message: Logged In: YES user_id=764593 Originator: NO (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) ---------------------------------------------------------------------- Comment By: Georg Brandl (gbrandl) Date: 2007-03-17 17:47 Message: Logged In: YES user_id=849994 Originator: NO Closed the other two patches as "superseded by this one". ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1678077&group_id=5470
_______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches