diff options
author | R David Murray <rdmurray@bitdance.com> | 2012-09-03 16:37:59 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2012-09-03 16:37:59 (GMT) |
commit | d674a770e9880f8587129e18bf7faa049c56c571 (patch) | |
tree | 71a0b24542769ee3669e44241379e4c35b75b03c /Lib | |
parent | f147d7345a840bd28396f0a718d31e6710078f06 (diff) | |
parent | 94dd7cb0c71dd9e43bd79df2281a8baa4f3f76ca (diff) | |
download | cpython-d674a770e9880f8587129e18bf7faa049c56c571.zip cpython-d674a770e9880f8587129e18bf7faa049c56c571.tar.gz cpython-d674a770e9880f8587129e18bf7faa049c56c571.tar.bz2 |
Merge #15509: If %action substitution produces a null string, drop it.
Patch by Anton Barkovsky, comment addition by me.
This shows up as a bug in 3.3 because the definition for Chrome
produces such an empty string. Tests will follow.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/webbrowser.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py index ce5b48e..8617425 100644 --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -206,12 +206,18 @@ class UnixBrowser(BaseBrowser): """Parent class for all Unix browsers with remote functionality.""" raise_opts = None + background = False + redirect_stdout = True + # In remote_args, %s will be replaced with the requested URL. %action will + # be replaced depending on the value of 'new' passed to open. + # remote_action is used for new=0 (open). If newwin is not None, it is + # used for new=1 (open_new). If newtab is not None, it is used for + # new=3 (open_new_tab). After both substitutions are made, any empty + # strings in the transformed remote_args list will be removed. remote_args = ['%action', '%s'] remote_action = None remote_action_newwin = None remote_action_newtab = None - background = False - redirect_stdout = True def _invoke(self, args, remote, autoraise): raise_opt = [] @@ -264,6 +270,7 @@ class UnixBrowser(BaseBrowser): args = [arg.replace("%s", url).replace("%action", action) for arg in self.remote_args] + args = [arg for arg in args if arg] success = self._invoke(args, True, autoraise) if not success: # remote invocation failed, try straight way |