Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
2ebd8f51
Kaydet (Commit)
2ebd8f51
authored
Eyl 05, 2015
tarafından
Steve Dower
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #25005: Backout fix for #8232 because of use of unsafe subprocess.call(shell=True)
üst
714e4937
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
114 deletions
+9
-114
webbrowser.py
Lib/webbrowser.py
+9
-111
NEWS
Misc/NEWS
+0
-3
No files found.
Lib/webbrowser.py
Dosyayı görüntüle @
2ebd8f51
...
@@ -495,23 +495,10 @@ if os.environ.get("TERM"):
...
@@ -495,23 +495,10 @@ if os.environ.get("TERM"):
#
#
if
sys
.
platform
[:
3
]
==
"win"
:
if
sys
.
platform
[:
3
]
==
"win"
:
class
WindowsDefault
(
BaseBrowser
):
class
WindowsDefault
(
BaseBrowser
):
# Windows Default opening arguments.
cmd
=
"start"
newwindow
=
""
newtab
=
""
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
True
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
True
):
# Format the command for optional arguments and add the url.
if
new
==
1
:
self
.
cmd
+=
" "
+
self
.
newwindow
elif
new
==
2
:
self
.
cmd
+=
" "
+
self
.
newtab
self
.
cmd
+=
" "
+
url
try
:
try
:
subprocess
.
call
(
self
.
cmd
,
shell
=
True
)
os
.
startfile
(
url
)
except
OSError
:
except
OSError
:
# [Error 22] No application is associated with the specified
# [Error 22] No application is associated with the specified
# file for this operation: '<URL>'
# file for this operation: '<URL>'
...
@@ -519,108 +506,19 @@ if sys.platform[:3] == "win":
...
@@ -519,108 +506,19 @@ if sys.platform[:3] == "win":
else
:
else
:
return
True
return
True
# Windows Sub-Classes for commonly used browsers.
class
InternetExplorer
(
WindowsDefault
):
"""Launcher class for Internet Explorer browser"""
cmd
=
"start iexplore.exe"
newwindow
=
""
newtab
=
""
class
WinChrome
(
WindowsDefault
):
"""Launcher class for windows specific Google Chrome browser"""
cmd
=
"start chrome.exe"
newwindow
=
"-new-window"
newtab
=
"-new-tab"
class
WinFirefox
(
WindowsDefault
):
"""Launcher class for windows specific Firefox browser"""
cmd
=
"start firefox.exe"
newwindow
=
"-new-window"
newtab
=
"-new-tab"
class
WinOpera
(
WindowsDefault
):
"""Launcher class for windows specific Opera browser"""
cmd
=
"start opera"
newwindow
=
""
newtab
=
""
class
WinSeaMonkey
(
WindowsDefault
):
"""Launcher class for windows specific SeaMonkey browser"""
cmd
=
"start seamonkey"
newwinow
=
""
newtab
=
""
_tryorder
=
[]
_tryorder
=
[]
_browsers
=
{}
_browsers
=
{}
# First try to use the default Windows browser
.
# First try to use the default Windows browser
register
(
"windows-default"
,
WindowsDefault
)
register
(
"windows-default"
,
WindowsDefault
)
def
find_windows_browsers
():
# Detect some common Windows browsers, fallback to IE
""" Access the windows registry to determine
iexplore
=
os
.
path
.
join
(
os
.
environ
.
get
(
"PROGRAMFILES"
,
"C:
\\
Program Files"
),
what browsers are on the system.
"Internet Explorer
\\
IEXPLORE.EXE"
)
"""
for
browser
in
(
"firefox"
,
"firebird"
,
"seamonkey"
,
"mozilla"
,
"netscape"
,
"opera"
,
iexplore
):
import
winreg
if
shutil
.
which
(
browser
):
HKLM
=
winreg
.
HKEY_LOCAL_MACHINE
register
(
browser
,
None
,
BackgroundBrowser
(
browser
))
subkey
=
r'Software\Clients\StartMenuInternet'
read32
=
winreg
.
KEY_READ
|
winreg
.
KEY_WOW64_32KEY
read64
=
winreg
.
KEY_READ
|
winreg
.
KEY_WOW64_64KEY
key32
=
winreg
.
OpenKey
(
HKLM
,
subkey
,
access
=
read32
)
key64
=
winreg
.
OpenKey
(
HKLM
,
subkey
,
access
=
read64
)
# Return a list of browsers found in the registry
# Check if there are any different browsers in the
# 32 bit location instead of the 64 bit location.
browsers
=
[]
i
=
0
while
True
:
try
:
browsers
.
append
(
winreg
.
EnumKey
(
key32
,
i
))
except
EnvironmentError
:
break
i
+=
1
i
=
0
while
True
:
try
:
browsers
.
append
(
winreg
.
EnumKey
(
key64
,
i
))
except
EnvironmentError
:
break
i
+=
1
winreg
.
CloseKey
(
key32
)
winreg
.
CloseKey
(
key64
)
return
browsers
# Detect some common windows browsers
for
browser
in
find_windows_browsers
():
browser
=
browser
.
lower
()
if
"iexplore"
in
browser
:
register
(
"iexplore"
,
None
,
InternetExplorer
(
"iexplore"
))
elif
"chrome"
in
browser
:
register
(
"chrome"
,
None
,
WinChrome
(
"chrome"
))
elif
"firefox"
in
browser
:
register
(
"firefox"
,
None
,
WinFirefox
(
"firefox"
))
elif
"opera"
in
browser
:
register
(
"opera"
,
None
,
WinOpera
(
"opera"
))
elif
"seamonkey"
in
browser
:
register
(
"seamonkey"
,
None
,
WinSeaMonkey
(
"seamonkey"
))
else
:
register
(
browser
,
None
,
WindowsDefault
(
browser
))
#
#
# Platform support for MacOS
# Platform support for MacOS
...
...
Misc/NEWS
Dosyayı görüntüle @
2ebd8f51
...
@@ -312,9 +312,6 @@ Library
...
@@ -312,9 +312,6 @@ Library
- Issue #14373: C implementation of functools.lru_cache() now can be used with
- Issue #14373: C implementation of functools.lru_cache() now can be used with
methods.
methods.
- Issue #8232: webbrowser support incomplete on Windows. Patch by Brandon
Milam
- Issue #24347: Set KeyError if PyDict_GetItemWithError returns NULL.
- Issue #24347: Set KeyError if PyDict_GetItemWithError returns NULL.
- Issue #24348: Drop superfluous incref/decref.
- Issue #24348: Drop superfluous incref/decref.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment