[issue43424] Document the `controller.name` field in `webbrowser` module

2021-12-29 Thread Ilya Grigoriev


Ilya Grigoriev  added the comment:

Thank you very much, Nikita! Your patch would certainly solve my issue.

As is, I checked the code I wrote, and it seems that only a lucky
ordering of if-statements caused it to work on Macs.

Ilya.

On Wed, Dec 29, 2021 at 5:30 PM Dong-hee Na  wrote:
>
>
> Dong-hee Na  added the comment:
>
>
> New changeset d12bec69931503be78cd555cf7bc22ad6f4f2bd5 by Nikita Sobolev in 
> branch 'main':
> bpo-43424: Deprecate `webbrowser.MacOSXOSAScript._name` attribute (GH-30241)
> https://github.com/python/cpython/commit/d12bec69931503be78cd555cf7bc22ad6f4f2bd5
>
>
> --
> nosy: +corona10
>
> ___
> Python tracker 
> <https://bugs.python.org/issue43424>
> ___

--

___
Python tracker 
<https://bugs.python.org/issue43424>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43424] Document the `controller.name` field in `webbrowser` module

2021-03-06 Thread Ilya Grigoriev


New submission from Ilya Grigoriev :

The object `webbrowser.get()` returns has, and had for a long time, a useful 
but undocumented field `name`. I wonder if it would be OK to document it as 
something like `a system-dependent name for the browser`. This would go here:

https://docs.python.org/3/library/webbrowser.html#browser-controller-objects

The reason I'd like this is so that I can write code like the following:

```python
# In Crostini Chrome OS Linux, the default browser is set to an
# intermediary called `garcon-url-handler`.
# It opens URLs in Chrome running outside the linux VM. This 
# browser does not have access to the Linux filesystem. Some references:
# 
https://chromium.googlesource.com/chromiumos/platform2/+/master/vm_tools/garcon/#opening-urls
# https://source.chromium.org/search?q=garcon-url-handler

if "garcon-url-handler" in webbrowser.get().name:
  webbrowser.open("http://external-url.com/docs.html;)
else:
  webbrowser.open("file:///usr/share/doc/docs.html")
```

This would work correctly, even if the user has installed a browser native to 
the Linux VM and put it into their `BROWSER` environment variable. I don't know 
a better way to achieve the same effect.

Some references to where the `name` field was introduced:

https://bugs.python.org/issue754022

https://github.com/python/cpython/commit/e8f244305ef4f257f6999b69601f4316b31faa5e

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 388218
nosy: docs@python, ilyagr
priority: normal
severity: normal
status: open
title: Document the `controller.name` field in `webbrowser` module
type: enhancement
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue43424>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com