Change 'env var BROWSER override' semantics in webbrowser.py
Hi, I propose a small change in webbrowse.py module. At the present time: """ Under Unix, if the environment variable BROWSER exists, it is interpreted to override the platform default list of browsers,... """ (extract from Python-2.4/Doc/html/lib/module-webbrowser.html) I propose the following change: ''' --- webbrowser.py 2005-03-18 17:43:58.736854784 -0300 +++ webbrowser.py.new 2005-03-18 17:29:57.016815680 -0300 @@ -355,7 +355,7 @@ if "BROWSER" in os.environ: # It's the user's responsibility to register handlers for any unknown # browser referenced by this value, before calling open(). - _tryorder = os.environ["BROWSER"].split(os.pathsep) + _tryorder = os.environ["BROWSER"].split(os.pathsep) + _tryorder for cmd in _tryorder: if not cmd.lower() in _browsers: ''' This changes the semantics a bit, but in a positive way: - When the environment variable BROWSER is messed up, there is no reason not to try the other detected browser alternatives - If the BROWSER variable is Ok, than it is respected If nobody stand against it, or would like to propose an alternative (optimized) implementation, I can submit a patch to sf to alter both code and documentation. I'd appreciate to know if you consider this a bug or a new feature ? I consider this a bug: """ The webbrowser module provides a very high-level interface to allow displaying Web-based documents to users. The controller objects are easy to use and are platform-independent. Under most circumstances, simply calling the open() function from this module will do the right thing. """ (extract from Python-2.4/Doc/html/lib/module-webbrowser.html) Ignoring valid *already* detected browsers, due to a broken environment variable does not sound like _do the right thing_. <wink> cheers, Senra -- Rodrigo Senra MSc Computer Engineer rodsenra@gpr.com.br GPr Sistemas Ltda http://www.gpr.com.br
Rodrigo Dias Arruda Senra wrote:
I propose a small change in webbrowse.py module.
I think I'm generally in favour of such a change. However: - please don't post patches to python-dev, unless you *want* them to be ignored. Typically, nobody will pick up patches from python-dev and apply them, except for rare cases (e.g. urgent bug fixes of serious breakages); post to SF instead. - please accompany your change with a documentation patch. It may be that the exact search procedure for browsers is not specified yet; take that chance and specify it so clearly that the code without your patch would actually conflict with the documentation, so that readers of the new code can verify that this is indeed the documentation-mandated behaviour. - consider integration of test cases. As this involves startup code and environment variables, I would be willing to waive the test case requirement here as unimplementable. However, do consider writing test cases. Regards, Martin
Martin v. Löwis wrote:
Rodrigo Dias Arruda Senra wrote:
I propose a small change in webbrowse.py module.
I think I'm generally in favour of such a change. However:
- please don't post patches to python-dev, unless you *want* them to be ignored. Typically, nobody will pick up patches from python-dev and apply them, except for rare cases (e.g. urgent bug fixes of serious breakages); post to SF instead. - please accompany your change with a documentation patch. It may be that the exact search procedure for browsers is not specified yet; take that chance and specify it so clearly that the code without your patch would actually conflict with the documentation, so that readers of the new code can verify that this is indeed the documentation-mandated behaviour. - consider integration of test cases. As this involves startup code and environment variables, I would be willing to waive the test case requirement here as unimplementable. However, do consider writing test cases.
Additionally, there are several patches on SF that pertain to webbrowser.py; perhaps you can review some of them... Reinhold -- Mail address is perfectly valid!
On Friday 18 March 2005 17:44, Reinhold Birkenfeld wrote:
Additionally, there are several patches on SF that pertain to webbrowser.py; perhaps you can review some of them...
Given the time I haven't been able to devote to the webbrowser module, a consolidated set of reviews would be very helpful. Patch reviews should be written in the tracker, as always, and a summary of all the webbrowser-related patches in a single email to python-dev. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org>
On Fri, Mar 18, 2005 at 06:55:09PM -0500, Fred L. Drake, Jr. wrote:
On Friday 18 March 2005 17:44, Reinhold Birkenfeld wrote:
Additionally, there are several patches on SF that pertain to webbrowser.py; perhaps you can review some of them...
Given the time I haven't been able to devote to the webbrowser module, a consolidated set of reviews would be very helpful.
Patch reviews should be written in the tracker, as always, and a summary of all the webbrowser-related patches in a single email to python-dev.
I am in game, as one of those patches is mine. I've started to review patches... Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Friday 18 March 2005 17:44, Reinhold Birkenfeld wrote:
Additionally, there are several patches on SF that pertain to webbrowser.py; perhaps you can review some of them...
By all means. Done!
Given the time I haven't been able to devote to the webbrowser module, a consolidated set of reviews would be very helpful.
Patch reviews should be written in the tracker, as always, and a summary of all the webbrowser-related patches in a single email to python-dev.
Thank you. That was valuable information. best regards, Rod Senra
I am in game, as one of those patches is mine. I've started to review patches...
Hi Oleg, Perhaps you could focus in 728278. It addresses some of the issues you have addressed in 754022, but it is not properly formatted. If you could merge into your patch the result of "set(728278)-set(754022)", it would be great. These two patches have the biggest number of changes, and most significant ones. Naturally they are also the most conflicting. If these two are merged, then I believe *all* webbrowser.py related patches could be addressed and closed quickly. best regards, Rod Senra
Rodrigo Dias Arruda Senra wrote:
I propose a small change in webbrowse.py module.
I think I'm generally in favour of such a change.
Thanks. I'm glad to know!
- please don't post patches to python-dev,
Sorry. I'm aware of that. For clarification's sake, I was not _posting_ a patch to the mailing list. My intention was to *discuss* the patch, and since it was so small, I found easier to copy it than to explain it. Since nobody opposed to the idea, I already have submitted a patch to the tracker (1166780 Fix _tryorder in webbrowser.py).
- please accompany your change with a documentation patch.
Indeed. Already available in sf.
I would be willing to waive the test case requirement here as unimplementable.
That is a relief in this particular case <wink>. Thank you for all your advice. best regards, Rod Senra
On Sun, Mar 20, 2005 at 11:40:27AM -0300, rodsenra@gpr.com.br wrote:
Perhaps you could focus in 728278. It addresses some of the issues you have addressed in 754022, but it is not properly formatted.
I started to look at it yesterday, but it's so big and does so many things at once... it requires a lot of time... Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Sun, Mar 20, 2005 at 11:40:27AM -0300, rodsenra@gpr.com.br wrote:
Perhaps you could focus in 728278. It addresses some of the issues you have addressed in 754022, but it is not properly formatted. If you could merge into your patch the result of "set(728278)-set(754022)", it would be great.
These two patches have the biggest number of changes, and most significant ones. Naturally they are also the most conflicting.
If these two are merged, then I believe *all* webbrowser.py related patches could be addressed and closed quickly.
I am working on them. I am going to consolidate these patches along with 954628 and 1166780 into one big patch. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Tue, Mar 22, 2005 at 01:28:42PM +0300, Oleg Broytmann wrote:
On Sun, Mar 20, 2005 at 11:40:27AM -0300, rodsenra@gpr.com.br wrote:
Perhaps you could focus in 728278. It addresses some of the issues you have addressed in 754022, but it is not properly formatted. If you could merge into your patch the result of "set(728278)-set(754022)", it would be great.
These two patches have the biggest number of changes, and most significant ones. Naturally they are also the most conflicting.
If these two are merged, then I believe *all* webbrowser.py related patches could be addressed and closed quickly.
I am working on them. I am going to consolidate these patches along with 954628 and 1166780 into one big patch.
Well, I've consolidated patches 728278, 954628, 1166780 into 754022. Some parts of those patches were applied, some rejected, many things changed. Suggested resolutions: http://python.org/sf/728278 Close with resolution "partially applied, partially rejected". http://python.org/sf/754022 Review and apply! ;) http://python.org/sf/1166780 Close with resolution "applied". (Though it was not applied in exactly that form...) http://python.org/sf/1077979 Close with resolution "applied long ago". http://python.org/sf/1144816 Close with resolution "duplicate of 1077979". I tested the consolidated patch on Linux with Mozilla/links/elinks browsers, and on w32 with default-browser and with Mozilla. I also added elinks support - currently it is very similar to links, but I am going to extend its remote capabilities. (Yes, that small text-mode broswer supports remoting, windows and tabs! Who'd think?!.) Also I'm going to add "new-tab" support similar to "new-window" for Mozilla/Firefox and elinks. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Wed, 23 Mar 2005 21:29:30 +0300
Oleg Broytmann
Suggested resolutions: http://python.org/sf/754022 Review and apply! ;)
Reviewed. Thank you Oleg, fine integration job. I added a +1 comment to the tracker and copied your remaining obs to 754022 history. So a commiter-dev just have to mind about 754022.
I also added elinks support - currently it is very similar to links, but I am going to extend its remote capabilities. (Yes, that small text-mode broswer supports remoting, windows and tabs! Who'd think?!.) Also I'm going to add "new-tab" support similar to "new-window" for Mozilla/Firefox and elinks.
Excellent. cheers, Rod Senra
On Wed, Mar 23, 2005 at 09:29:30PM +0300, Oleg Broytmann wrote:
I also added elinks support - currently it is very similar to links, but I am going to extend its remote capabilities. (Yes, that small text-mode broswer supports remoting, windows and tabs! Who'd think?!.) Also I'm going to add "new-tab" support similar to "new-window" for Mozilla/Firefox and elinks.
I've reworked the patch once more. I moved some common functionality into the UnixBrowser class and added two new features - Elinks launcher class (elinks supports remote commands in a manner very similar to Mozilla) and new-tab functionality for browsers that support tabbed browsing (Mozilla and elinks); a user can now run "webbrowser -t URL" to open the URL a new tab. All classes in the module are now new-style classes (except for the Error class). All .open() methods accept "new" parameter: 0 - open the url in the same window, 1 - open in a new window (0 and 1 codes works as before), and new code 2 - open in a new tab if possible. These are probably the last features I wanted to add to the module. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Thu, 24 Mar 2005 16:30:35 +0300
Oleg Broytmann
I've reworked the patch once more. I moved some common functionality into the UnixBrowser class and added two new features ...
I do not want to abuse your generosity. However, if you could make the necessary changes to the documentation, since it will be easier to you than anyone else right know, I'll gladly check the consistency between code and docs. tchau, Senra -- Rodrigo Senra rsenra _at_ acm _dot_ org http://www.ic.unicamp.br/~921234
On Thu, Mar 24, 2005 at 11:11:11AM -0300, Rodrigo Dias Arruda Senra wrote:
However, if you could make the necessary changes to the documentation,
I'll try, but certainly not in TeX format... Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Thu, 24 Mar 2005 17:13:30 +0300
Oleg Broytmann
On Thu, Mar 24, 2005 at 11:11:11AM -0300, Rodrigo Dias Arruda Senra wrote:
However, if you could make the necessary changes to the documentation,
I'll try, but certainly not in TeX format...
Edit libwebbrowser.tex as you see fit, then send it to me and I'll TeXify it back to you. <wink> tchau, Rod -- Rodrigo Senra MSc Computer Engineer rodsenra@gpr.com.br GPr Sistemas Ltda http://www.gpr.com.br
Hi! On Thu, Mar 24, 2005 at 11:36:41AM -0300, Rodrigo Dias Arruda Senra wrote:
Edit libwebbrowser.tex as you see fit, then send it to me and I'll TeXify it back to you. <wink>
Uploaded to http://python.org/sf/754022 . I am not a native English speaker, and this is the first time I've edited a TeX file. Please correct my grammar, spelling, TeX, whatever... Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
participants (7)
-
"Martin v. Löwis"
-
Fred L. Drake, Jr.
-
Oleg Broytmann
-
Oleg Broytmann
-
Reinhold Birkenfeld
-
Rodrigo Dias Arruda Senra
-
rodsenra@gpr.com.br