Issue1678077
Created on 2007-03-10 22:11 by sonderblade, last changed 2009-04-01 16:21 by jackdied.
|
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 (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.
|
|
msg52167 - (view) |
Author: Georg Brandl (georg.brandl) |
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) |
Date: 2009-04-01 16:21 |
|
assigning all open telnetlib items to myself
|
|
| Date |
User |
Action |
Args |
| 2009-04-01 16:21:54 | jackdied | set | assignee: jackdied
messages:
+ msg85039 nosy:
+ jackdied |
| 2008-01-06 22:29:46 | admin | set | keywords:
- py3k versions:
Python 3.0 |
| 2007-08-30 00:22:03 | gvanrossum | set | versions:
+ Python 3.0 |
| 2007-03-10 22:11:38 | sonderblade | create | |
|