[Python-checkins] [python/cpython] e3ce69: bpo-24241: Improve preferred webbrowser handling (...

GitHub noreply at github.com
Fri Feb 24 23:47:39 EST 2017


  Branch: refs/heads/master
  Home:   https://github.com/python/cpython
  Commit: e3ce69522ffd7c0354d6e70d18f42bce325ed97e
      https://github.com/python/cpython/commit/e3ce69522ffd7c0354d6e70d18f42bce325ed97e
  Author: David Steele <davesteele at users.noreply.github.com>
  Date:   2017-02-25 (Sat, 25 Feb 2017)

  Changed paths:
    M Doc/library/webbrowser.rst
    M Lib/webbrowser.py
    M Misc/ACKS
    M Misc/NEWS

  Log Message:
  -----------
  bpo-24241: Improve preferred webbrowser handling (#85)

- Add 'preferred' argument to webbrowser.register
- Use xdg-settings to specify preferred X browser

The first change replaces the existing undocumented tri-state
'try_order' parameter with the documented boolean keyword-only
'preferred' parameter. Setting it to True places the browser at the
front of the list, preferring it as the return to a subsequent get() call.

The second change adds a private `_os_preferred_browser` setting
and then uses that to make the default browser reported by
`xdg-settings` first in the try list when running under X (or
another environment that sets the `DISPLAY` variable).
This avoids the problem where the first entry in the tryorder
queue otherwise defaults to xdg-open, which doesn't support
the "new window" option.




More information about the Python-checkins mailing list