This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Greatly enhanced webbrowser.py
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, georg.brandl, nnorwitz, phd, quiver, rhettinger, rodsenra
Priority: normal Keywords: patch

Created on 2003-06-13 15:24 by phd, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
webbrowser phd, 2005-03-23 21:18 webbrowser wrapper script
webbrowser.py.patch phd, 2005-03-30 11:01 Big webbrowser.py patch
webbrowser.diff georg.brandl, 2005-09-15 08:07 New patch by birkenfeld
libwebbrowser.tex.patch phd, 2005-09-23 14:10
Messages (32)
msg43954 - (view) Author: Oleg Broytman (phd) * Date: 2003-06-13 15:24
The patch enhances webbrowser.py.

First, all calls to os.system return result code, and
the inverse of the code (it is ok/fail status) passed
through all higher-level routines up to top-level call
to open(url). This allows to check if a browser was
really started.

Second, the very open() modified so it is now trying to
run all registered browsers in order until a browser
returns 1.

Third, the file can be used as a program: webbrowser.py
url. Optional parameters -n allows to open the url in a
new window.
msg43955 - (view) Author: Oleg Broytman (phd) * Date: 2004-10-07 07:48
Logged In: YES 
user_id=4799

And don't forget to make it executable.
msg43956 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-10-20 06:11
Logged In: YES 
user_id=80475

Too late for Py2.4.
msg43957 - (view) Author: Oleg Broytman (phd) * Date: 2004-12-07 11:23
Logged In: YES 
user_id=4799

Applied the patch from http://python.org/sf/1077979.
msg43958 - (view) Author: Oleg Broytman (phd) * Date: 2005-03-23 18:06
Logged In: YES 
user_id=4799

I've consolidated patches 728278, 754022, 954628, 1166780
into this single patch. Some parts of those patches were
applied, some rejected, many things changed. I also added
elinks support - currently it is very similar to links.
msg43959 - (view) Author: Rodrigo Dias Arruda Senra (rodsenra) Date: 2005-03-23 19:25
Logged In: YES 
user_id=9057

I have reviewed this patch in 2005-03-23 and recommend it to
be applied ! 

Oleg have made the comments below to Python-dev, and those
must be taken into consideration while applying this patch.

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".
msg43960 - (view) Author: Oleg Broytman (phd) * Date: 2005-03-23 21:14
Logged In: YES 
user_id=4799

I've moved script code to main() function.
msg43961 - (view) Author: Oleg Broytman (phd) * Date: 2005-03-23 21:17
Logged In: YES 
user_id=4799

There's no uploaded file!  You have to check the
checkbox labeled "Check to Upload & Attach File"
when you upload a file. In addition, even if you
*did* check this checkbox, a bug in SourceForge
prevents attaching a file when *creating* an issue.

Please try again.

(This is a SourceForge annoyance that we can do
nothing about. :-( )
msg43962 - (view) Author: Oleg Broytman (phd) * Date: 2005-03-23 21:18
Logged In: YES 
user_id=4799

Uploading webbrowser wrapper script. Put it into
Tools/scripts directory, and add to the end of setup.py.
msg43963 - (view) Author: Oleg Broytman (phd) * Date: 2005-03-24 13:14
Logged In: YES 
user_id=4799

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).
msg43964 - (view) Author: Oleg Broytman (phd) * Date: 2005-03-24 13:30
Logged In: YES 
user_id=4799

Do not report error if the browser doesn't support tabs -
just open the URL in a new window.
msg43965 - (view) Author: Oleg Broytman (phd) * Date: 2005-03-28 14:19
Logged In: YES 
user_id=4799

Minor bugfix.
msg43966 - (view) Author: Oleg Broytman (phd) * Date: 2005-03-28 14:21
Logged In: YES 
user_id=4799

Patch for documentation.
msg43967 - (view) Author: Rodrigo Dias Arruda Senra (rodsenra) Date: 2005-03-28 21:25
Logged In: YES 
user_id=9057

I have revised: 	libwebbrowser.tex.patch and
webbrowser.py.patch.
They are Ok, I recommend to apply both. Outstanding work.

However, I would withdraw the webbrowser wrapper script,
since the same functionality can be accomplished with:
python -m webbrowser http://www.python.org

msg43968 - (view) Author: Oleg Broytman (phd) * Date: 2005-03-29 08:48
Logged In: YES 
user_id=4799

Changed _isexecutable() on w32 to test for executable
extensions (.exe, bat) . Tested on Linux with
Mozilla/links/elinks; on w32 with Mozilla/Opera/Firefox.
msg43969 - (view) Author: Oleg Broytman (phd) * Date: 2005-03-29 08:50
Logged In: YES 
user_id=4799

Updated documention patch - added a section about webbrowser
script and its command-line options and arguments.
msg43970 - (view) Author: Oleg Broytman (phd) * Date: 2005-03-30 11:01
Logged In: YES 
user_id=4799

Added remote functionality for Opera on Unix.
msg43971 - (view) Author: Oleg Broytman (phd) * Date: 2005-03-30 11:02
Logged In: YES 
user_id=4799

Added Opera controller to the doc.
msg43972 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-06-01 16:33
Logged In: YES 
user_id=1188172

I have reviewed this one too, and I really recommend to
apply it for 2.5.
msg43973 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-09-15 08:07
Logged In: YES 
user_id=1188172

Adding new patch (webbrowser.diff), enhanced with other
patches and bugfixes here on SF.
Also updated the docs with changed/added notes.

Please review, I'll apply this for 2.5.
msg43974 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2005-09-15 17:26
Logged In: YES 
user_id=671362

Let me point out two problems:

o NameError 

    if remote_background:
        cmd += ' &'
=>
    if self.remote_background:	 # add "self."
        cmd += ' &'

o copy and paste mistake?

  \lineiii{'mozilla'}{\class{Mozilla('mozilla')}}{}
  \lineiii{'firefox'}{\class{Mozilla('mozilla')}}{}
=>
  \lineiii{'mozilla'}{\class{Mozilla('mozilla')}}{}
  \lineiii{'firefox'}{\class{Mozilla('firefox')}}{}
msg43975 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-09-15 19:49
Logged In: YES 
user_id=1188172

Ah, thanks. I had already corrected #1, but didn't look
closely enough for #2.
msg43976 - (view) Author: Oleg Broytman (phd) * Date: 2005-09-15 20:18
Logged In: YES 
user_id=4799

In the main():

        opts, args = getopt.getopt(sys.argv[1:], 'ntd')

You can remove 'd' as you've dropeed debugging prints.


Are you going to drop standalone webbrowser script? Is
"python -m webbrowser" enough?
msg43977 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-09-15 20:48
Logged In: YES 
user_id=1188172

No other module that can be used standalone delivers such a
script. There's also the question where to install it, etc.
msg43978 - (view) Author: Oleg Broytman (phd) * Date: 2005-09-15 21:52
Logged In: YES 
user_id=4799

From setup.py:

          scripts = ['Tools/scripts/pydoc',
'Tools/scripts/idle',
                     'Lib/smtpd.py']

See, Python installs 3 scripts into /usr/{local/}bin/ -
pydoc, idle and smtpd.py.
msg43979 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-09-16 06:32
Logged In: YES 
user_id=1188172

Granted, but you will concur that starting a webbrowser
isn't something that the command line user normally wants to
do via a Python script.
msg43980 - (view) Author: Oleg Broytman (phd) * Date: 2005-09-16 07:28
Logged In: YES 
user_id=4799

Arguable (especially compared with smtpd.py), but I am not
goint to argue. Please apply the patch and let us see what
other people think and say. It seems there are enough users...
msg43981 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2005-09-22 03:35
Logged In: YES 
user_id=671362

Minor nit.

11.1.1 Browser Controller Objects 
from the description of open method::
> If new is true, a new browser window is opened if possible.

Now "new" can be 0, 1 or 2. This part also needs an update.
msg43982 - (view) Author: Oleg Broytman (phd) * Date: 2005-09-23 14:09
Logged In: YES 
user_id=4799

Done. New libwebbrowser.tex.patch is about to be uploaded.
Thank you!
msg43983 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-10-03 14:17
Logged In: YES 
user_id=1188172

Committed the patch as Lib/webbrowser.py r1.38,
Doc/lib/libwebbrowser.tex r1.11.
msg43984 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005-10-27 05:29
Logged In: YES 
user_id=33168

There are a couple of bugs reported in 1338995 that appear
to be associated with this patch.  Could someone take a look
and provide updates?
msg43985 - (view) Author: Oleg Broytman (phd) * Date: 2005-10-27 15:37
Logged In: YES 
user_id=4799

One of these two is a bug. But the orther is not. Thank you
for spotting.
History
Date User Action Args
2022-04-10 16:09:11adminsetgithub: 38645
2003-06-13 15:24:50phdcreate