mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
Merged revisions 80698 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r80698 | ronald.oussoren | 2010-05-02 11:48:21 +0200 (Sun, 02 May 2010) | 3 lines For for issue #7192: with this patch webbrowser.get("firefox") works on OSX ........
This commit is contained in:
parent
9f608be902
commit
4d39f6e09a
2 changed files with 30 additions and 1 deletions
|
|
@ -600,9 +600,35 @@ if sys.platform == 'darwin':
|
||||||
rc = osapipe.close()
|
rc = osapipe.close()
|
||||||
return not rc
|
return not rc
|
||||||
|
|
||||||
|
class MacOSXOSAScript(BaseBrowser):
|
||||||
|
def __init__(self, name):
|
||||||
|
self._name = name
|
||||||
|
|
||||||
|
def open(self, url, new=0, autoraise=True):
|
||||||
|
if self._name == 'default':
|
||||||
|
script = 'open location "%s"' % url.replace('"', '%22') # opens in default browser
|
||||||
|
else:
|
||||||
|
script = '''
|
||||||
|
tell application "%s"
|
||||||
|
activate
|
||||||
|
open location "%s"
|
||||||
|
end
|
||||||
|
'''%(self._name, url.replace('"', '%22'))
|
||||||
|
|
||||||
|
osapipe = os.popen("osascript", "w")
|
||||||
|
if osapipe is None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
osapipe.write(script)
|
||||||
|
rc = osapipe.close()
|
||||||
|
return not rc
|
||||||
|
|
||||||
|
|
||||||
# Don't clear _tryorder or _browsers since OS X can use above Unix support
|
# Don't clear _tryorder or _browsers since OS X can use above Unix support
|
||||||
# (but we prefer using the OS X specific stuff)
|
# (but we prefer using the OS X specific stuff)
|
||||||
register("MacOSX", None, MacOSX('default'), -1)
|
register("safari", None, MacOSXOSAScript('safari'), -1)
|
||||||
|
register("firefox", None, MacOSXOSAScript('firefox'), -1)
|
||||||
|
register("MacOSX", None, MacOSXOSAScript('default'), -1)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -345,6 +345,9 @@ C-API
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #7192: webbrowser.get("firefox") now wors on Mac OS X, as does
|
||||||
|
webbrowser.get("safari").
|
||||||
|
|
||||||
- Issue #8464: tarfile no longer creates files with execute permissions set
|
- Issue #8464: tarfile no longer creates files with execute permissions set
|
||||||
when mode="w|" is used.
|
when mode="w|" is used.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue