[Python-checkins] r54486 - in python/branches/release25-maint: Lib/webbrowser.py Misc/NEWS

georg.brandl python-checkins at python.org
Wed Mar 21 12:52:42 CET 2007


Author: georg.brandl
Date: Wed Mar 21 12:52:38 2007
New Revision: 54486

Modified:
   python/branches/release25-maint/Lib/webbrowser.py
   python/branches/release25-maint/Misc/NEWS
Log:
Bug #1684254: webbrowser now uses shlex to split any command lines
given to get(). It also detects when you use '&' as the last argument
and creates a BackgroundBrowser then.
 (backport)

Modified: python/branches/release25-maint/Lib/webbrowser.py
==============================================================================
--- python/branches/release25-maint/Lib/webbrowser.py	(original)
+++ python/branches/release25-maint/Lib/webbrowser.py	Wed Mar 21 12:52:38 2007
@@ -2,6 +2,7 @@
 """Interfaces for launching and remotely controlling Web browsers."""
 
 import os
+import shlex
 import sys
 import stat
 import subprocess
@@ -32,7 +33,11 @@
     for browser in alternatives:
         if '%s' in browser:
             # User gave us a command line, split it into name and args
-            return GenericBrowser(browser.split())
+            browser = shlex.split(browser)
+            if browser[-1] == '&':
+                return BackgroundBrowser(browser[:-1])
+            else:
+                return GenericBrowser(browser)
         else:
             # User gave us a browser name or path.
             try:

Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Wed Mar 21 12:52:38 2007
@@ -217,6 +217,10 @@
 Library
 -------
 
+- Bug #1684254: webbrowser now uses shlex to split any command lines
+  given to get(). It also detects when you use '&' as the last argument
+  and creates a BackgroundBrowser then.
+
 - Patch #1681153: the wave module now closes a file object it opened if
   initialization failed.
 


More information about the Python-checkins mailing list