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: change to ease option handling.
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: ernestjwtk, georg.brandl, sonderblade
Priority: normal Keywords: patch

Created on 2006-07-10 16:48 by ernestjwtk, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit ernestjwtk, 2006-07-10 16:48 patch to allow option handling in derived class of class telnet ernestjwtk, 2006-07-10 17:09 same patch but using latest svn diff instead of python 2.4
Messages (6)
msg50645 - (view) Author: Ernest ter Kuile (ernestjwtk) Date: 2006-07-10 16:48 has no automatic telnet option handling
mechanism except for the possibility to register a
callback function. If set, the callback is used for
each option as they arrive. If not set, options are

Using this mechanisme is not elegant when extending the
telnet class in a OO way, and there is currently no
other way to handle this data. 

This patch adds to the callback mechanisme by also
calling an internal function handle_option(), which by
default doesn't do much. This function could then do
something usefull when extending the telnet class.

For backwards compatibility, the current callback
mechanism has not been removed, and, if used, has
priority over the internal function handle_option(),
which is then ignored.

Furthermore to explain the telnet option system, a lot
of comments have been added.

msg50646 - (view) Author: Ernest ter Kuile (ernestjwtk) Date: 2006-07-10 17:09
Logged In: YES 

Changed Category to be Library instead of Modules. is not a module (sorry for confusion) 

Also attached is diff to latest svn telnetlib had some
timeout patch had been applied. (as of 10 july) 

Actually, first look shows no difference between this one
and the previous one, but just to be sure.

Ernest ter Kuile.
msg50647 - (view) Author: Björn Lindqvist (sonderblade) Date: 2007-03-08 21:48
Since this feature does not add something and is just a new way to do something that was already possible, maybe it can wait until py3k? I think having a handle_option() method is clearly a cleaner design than having a callback. But the advantage is not that great and in py3k you could break the api and replace the old method with the new one.
msg50648 - (view) Author: Ernest ter Kuile (ernestjwtk) Date: 2007-03-10 23:13
Wel it does, and this is why I needed it. For me it added two very important things:
1) it adds the possibility to create a descendant of the telnet class which can handle the options. Without this, the callback mechanism must always be handled externaly to the telnet object itself.

2) And since the callback has no concept of self (missing parameters) it adds the possibility to have more than one instance of the telnet class which did not need a different version of the callback function each time.
I needed about 6 instances (one for each system I had to reach), so had to provide 6 _different_ callback functions. (This showed to me that the callback way of doing was totally broken)

I wanted to (and did) encapsulate the telnet object with something which itself could provide the knowlege of handling some of the options (in fact a telnet 3270, which is a special case of the telnet protocol). This would have been very much harder to do without being able to handle the options within the objet.

Sorry if I wasn't clear.

msg50649 - (view) Author: Ernest ter Kuile (ernestjwtk) Date: 2007-03-11 00:04
sonderblade: I just noticed your new patch and submission. Looks good at first glance. I'll keep my current patch for myself as I don't think Python 3 will come out just yet, But I'll gladly use your version when it does. I too think it best to get rid of the callback mechanism for the reasons described below, but since I didn't want to be too radical I only added to it. 


msg50650 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-17 21:46
Superseded by sonderblade's patch at #1678077.
Date User Action Args
2022-04-11 14:56:18adminsetgithub: 43644
2006-07-10 16:48:52ernestjwtkcreate