diff options
author | Skip Montanaro <skip@pobox.com> | 2001-07-18 20:03:32 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2001-07-18 20:03:32 (GMT) |
commit | cdab3bf7eb0810fcda21be065868f3da330779a1 (patch) | |
tree | 81dd5a062f8045d701a57c8162e9e65fe3617a8b /Lib | |
parent | 6c299265878d513b77d31207c0e2f24b1ef59c28 (diff) | |
download | cpython-cdab3bf7eb0810fcda21be065868f3da330779a1.zip cpython-cdab3bf7eb0810fcda21be065868f3da330779a1.tar.gz cpython-cdab3bf7eb0810fcda21be065868f3da330779a1.tar.bz2 |
If the user's environment has set the BROWSER environment variable (as Gnome
seems to do), the user may not be aware of its contents. Attempt to add any
to _browsers.
closes bug #429136
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/webbrowser.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py index ad195e0..055705d 100644 --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -306,11 +306,14 @@ if os.environ.has_key("BROWSER"): # 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(":") -else: - # Optimization: filter out alternatives that aren't available, so we can - # avoid has_key() tests at runtime. (This may also allow some unused - # classes and class-instance storage to be garbage-collected.) - _tryorder = filter(lambda x: _browsers.has_key(x.lower()) - or x.find("%s") > -1, _tryorder) + +for cmd in _tryorder: + if not _browsers.has_key(cmd.lower()): + if _iscommand(cmd.lower()): + register(cmd.lower(), None, GenericBrowser("%s %%s" % cmd.lower())) + +_tryorder = filter(lambda x: _browsers.has_key(x.lower()) + or x.find("%s") > -1, _tryorder) +# what to do if _tryorder is now empty? # end |