[Python-Dev] Change 'env var BROWSER override' semantics in webbrowser.py (original) (raw)
Rodrigo Dias Arruda Senra rodsenra at gpr.com.br
Fri Mar 18 21:56:17 CET 2005
- Previous message: [Python-Dev] Re: [Python-checkins] python/dist/src/Doc/lib libcsv.tex, 1.18, 1.19
- Next message: [Python-Dev] Change 'env var BROWSER override' semantics in webbrowser.py
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
cheers, Senra
-- Rodrigo Senra MSc Computer Engineer rodsenra at gpr.com.br GPr Sistemas Ltda http://www.gpr.com.br
- Previous message: [Python-Dev] Re: [Python-checkins] python/dist/src/Doc/lib libcsv.tex, 1.18, 1.19
- Next message: [Python-Dev] Change 'env var BROWSER override' semantics in webbrowser.py
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]