[Python-checkins] cpython (3.5): Issue #23262: The webbrowser module now supports Firefox 36+ and derived

serhiy.storchaka python-checkins at python.org
Sun Oct 30 13:22:32 EDT 2016


https://hg.python.org/cpython/rev/dacb52577c1c
changeset: 104825:dacb52577c1c
branch: 3.5
parent: 104822:394b2b4da150
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sun Oct 30 19:16:33 2016 +0200
summary:
 Issue #23262: The webbrowser module now supports Firefox 36+ and derived
browsers. Based on patch by Oleg Broytman.
files:
 Lib/test/test_webbrowser.py | 25 ++++++++++++++++++++++
 Lib/webbrowser.py | 28 +++++++++++++++++-------
 Misc/NEWS | 3 ++
 3 files changed, 48 insertions(+), 8 deletions(-)
diff --git a/Lib/test/test_webbrowser.py b/Lib/test/test_webbrowser.py
--- a/Lib/test/test_webbrowser.py
+++ b/Lib/test/test_webbrowser.py
@@ -95,6 +95,31 @@
 
 def test_open(self):
 self._test('open',
+ options=[],
+ arguments=[URL])
+
+ def test_open_with_autoraise_false(self):
+ self._test('open', kw=dict(autoraise=False),
+ options=[],
+ arguments=[URL])
+
+ def test_open_new(self):
+ self._test('open_new',
+ options=[],
+ arguments=['-new-window', URL])
+
+ def test_open_new_tab(self):
+ self._test('open_new_tab',
+ options=[],
+ arguments=['-new-tab', URL])
+
+
+class NetscapeCommandTest(CommandTestMixin, unittest.TestCase):
+
+ browser_class = webbrowser.Netscape
+
+ def test_open(self):
+ self._test('open',
 options=['-raise', '-remote'],
 arguments=['openURL({})'.format(URL)])
 
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -245,7 +245,17 @@
 
 
 class Mozilla(UnixBrowser):
- """Launcher class for Mozilla/Netscape browsers."""
+ """Launcher class for Mozilla browsers."""
+
+ remote_args = ['%action', '%s']
+ remote_action = ""
+ remote_action_newwin = "-new-window"
+ remote_action_newtab = "-new-tab"
+ background = True
+
+
+class Netscape(UnixBrowser):
+ """Launcher class for Netscape browser."""
 
 raise_opts = ["-noraise", "-raise"]
 remote_args = ['-remote', 'openURL(%s%action)']
@@ -254,8 +264,6 @@
 remote_action_newtab = ",new-tab"
 background = True
 
-Netscape = Mozilla
-
 
 class Galeon(UnixBrowser):
 """Launcher class for Galeon/Epiphany browsers."""
@@ -430,14 +438,18 @@
 if shutil.which("x-www-browser"):
 register("x-www-browser", None, BackgroundBrowser("x-www-browser"))
 
- # The Mozilla/Netscape browsers
- for browser in ("mozilla-firefox", "firefox",
- "mozilla-firebird", "firebird",
- "iceweasel", "iceape",
- "seamonkey", "mozilla", "netscape"):
+ # The Mozilla browsers
+ for browser in ("firefox", "iceweasel", "iceape", "seamonkey"):
 if shutil.which(browser):
 register(browser, None, Mozilla(browser))
 
+ # The Netscape and old Mozilla browsers
+ for browser in ("mozilla-firefox",
+ "mozilla-firebird", "firebird",
+ "mozilla", "netscape"):
+ if shutil.which(browser):
+ register(browser, None, Netscape(browser))
+
 # Konqueror/kfm, the KDE browser.
 if shutil.which("kfm"):
 register("kfm", Konqueror, Konqueror("kfm"))
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -113,6 +113,9 @@
 Library
 -------
 
+- Issue #23262: The webbrowser module now supports Firefox 36+ and derived
+ browsers. Based on patch by Oleg Broytman.
+
 - Issue #27939: Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused
 by representing the scale as float value internally in Tk. tkinter.IntVar
 now works if float value is set to underlying Tk variable.
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /