[Patches] [ python-Patches-754022 ] Greatly enhanced webbrowser.py

SourceForge.net noreply at sourceforge.net
Thu Oct 27 07:29:02 CEST 2005


Patches item #754022, was opened at 2003-06-13 08:24
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=754022&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.5
Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Oleg Broytmann (phd)
Assigned to: Reinhold Birkenfeld (birkenfeld)
Summary: Greatly enhanced webbrowser.py

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2005-10-26 22:29

Message:
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?

----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-10-03 07:17

Message:
Logged In: YES 
user_id=1188172

Committed the patch as Lib/webbrowser.py r1.38,
Doc/lib/libwebbrowser.tex r1.11.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-09-23 07:09

Message:
Logged In: YES 
user_id=4799

Done. New libwebbrowser.tex.patch is about to be uploaded.
Thank you!

----------------------------------------------------------------------

Comment By: George Yoshida (quiver)
Date: 2005-09-21 20:35

Message:
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.


----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-09-16 00:28

Message:
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...

----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-09-15 23:32

Message:
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.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-09-15 14:52

Message:
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.

----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-09-15 13:48

Message:
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.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-09-15 13:18

Message:
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?

----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-09-15 12:49

Message:
Logged In: YES 
user_id=1188172

Ah, thanks. I had already corrected #1, but didn't look
closely enough for #2.

----------------------------------------------------------------------

Comment By: George Yoshida (quiver)
Date: 2005-09-15 10:26

Message:
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')}}{}


----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-09-15 01:07

Message:
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.

----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-06-01 09:33

Message:
Logged In: YES 
user_id=1188172

I have reviewed this one too, and I really recommend to
apply it for 2.5.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-03-30 03:02

Message:
Logged In: YES 
user_id=4799

Added Opera controller to the doc.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-03-30 03:01

Message:
Logged In: YES 
user_id=4799

Added remote functionality for Opera on Unix.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-03-29 00:50

Message:
Logged In: YES 
user_id=4799

Updated documention patch - added a section about webbrowser
script and its command-line options and arguments.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-03-29 00:48

Message:
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.

----------------------------------------------------------------------

Comment By: Rodrigo Dias Arruda Senra (rodsenra)
Date: 2005-03-28 13:25

Message:
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



----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-03-28 06:21

Message:
Logged In: YES 
user_id=4799

Patch for documentation.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-03-28 06:19

Message:
Logged In: YES 
user_id=4799

Minor bugfix.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-03-24 05:30

Message:
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.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-03-24 05:14

Message:
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).

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-03-23 13:18

Message:
Logged In: YES 
user_id=4799

Uploading webbrowser wrapper script. Put it into
Tools/scripts directory, and add to the end of setup.py.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-03-23 13:17

Message:
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. :-( )

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-03-23 13:14

Message:
Logged In: YES 
user_id=4799

I've moved script code to main() function.

----------------------------------------------------------------------

Comment By: Rodrigo Dias Arruda Senra (rodsenra)
Date: 2005-03-23 11:25

Message:
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".


----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2005-03-23 10:06

Message:
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.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2004-12-07 03:23

Message:
Logged In: YES 
user_id=4799

Applied the patch from http://python.org/sf/1077979.

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2004-10-19 23:11

Message:
Logged In: YES 
user_id=80475

Too late for Py2.4.

----------------------------------------------------------------------

Comment By: Oleg Broytmann (phd)
Date: 2004-10-07 00:48

Message:
Logged In: YES 
user_id=4799

And don't forget to make it executable.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=754022&group_id=5470


More information about the Patches mailing list