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
4b219ce8
Kaydet (Commit)
4b219ce8
authored
Mar 01, 2019
tarafından
Stéphane Wirtel
Kaydeden (comit)
Miss Islington (bot)
Mar 01, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-36043: FileCookieJar supports os.PathLike (GH-11945)
https://bugs.python.org/issue36043
üst
bda918bf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
4 deletions
+35
-4
http.cookiejar.rst
Doc/library/http.cookiejar.rst
+7
-0
cookiejar.py
Lib/http/cookiejar.py
+2
-4
test_http_cookiejar.py
Lib/test/test_http_cookiejar.py
+25
-0
2019-02-19-19-53-46.bpo-36043.l867v0.rst
...S.d/next/Library/2019-02-19-19-53-46.bpo-36043.l867v0.rst
+1
-0
No files found.
Doc/library/http.cookiejar.rst
Dosyayı görüntüle @
4b219ce8
...
...
@@ -71,6 +71,10 @@ The following classes are provided:
:meth:`load` or :meth:`revert` method is called. Subclasses of this class are
documented in section :ref:`file-cookie-jar-classes`.
.. versionchanged:: 3.8
The filename parameter supports a :term:`path-like object`.
.. class:: CookiePolicy()
...
...
@@ -341,6 +345,9 @@ writing.
compatible with the libwww-perl library's ``Set-Cookie3`` file format. This is
convenient if you want to store cookies in a human-readable file.
.. versionchanged:: 3.8
The filename parameter supports a :term:`path-like object`.
.. _cookie-policy-objects:
...
...
Lib/http/cookiejar.py
Dosyayı görüntüle @
4b219ce8
...
...
@@ -28,6 +28,7 @@ http://wwwsearch.sf.net/):
__all__
=
[
'Cookie'
,
'CookieJar'
,
'CookiePolicy'
,
'DefaultCookiePolicy'
,
'FileCookieJar'
,
'LWPCookieJar'
,
'LoadError'
,
'MozillaCookieJar'
]
import
os
import
copy
import
datetime
import
re
...
...
@@ -1762,10 +1763,7 @@ class FileCookieJar(CookieJar):
"""
CookieJar
.
__init__
(
self
,
policy
)
if
filename
is
not
None
:
try
:
filename
+
""
except
:
raise
ValueError
(
"filename must be string-like"
)
filename
=
os
.
fspath
(
filename
)
self
.
filename
=
filename
self
.
delayload
=
bool
(
delayload
)
...
...
Lib/test/test_http_cookiejar.py
Dosyayı görüntüle @
4b219ce8
...
...
@@ -6,6 +6,7 @@ import test.support
import
time
import
unittest
import
urllib.request
import
pathlib
from
http.cookiejar
import
(
time2isoz
,
http2time
,
iso2time
,
time2netscape
,
parse_ns_headers
,
join_header_words
,
split_header_words
,
Cookie
,
...
...
@@ -313,6 +314,30 @@ def _interact(cookiejar, url, set_cookie_hdrs, hdr_name):
class
FileCookieJarTests
(
unittest
.
TestCase
):
def
test_constructor_with_str
(
self
):
filename
=
test
.
support
.
TESTFN
c
=
LWPCookieJar
(
filename
)
self
.
assertEqual
(
c
.
filename
,
filename
)
def
test_constructor_with_path_like
(
self
):
filename
=
pathlib
.
Path
(
test
.
support
.
TESTFN
)
c
=
LWPCookieJar
(
filename
)
self
.
assertEqual
(
c
.
filename
,
os
.
fspath
(
filename
))
def
test_constructor_with_none
(
self
):
c
=
LWPCookieJar
(
None
)
self
.
assertIsNone
(
c
.
filename
)
def
test_constructor_with_other_types
(
self
):
class
A
:
pass
for
type_
in
(
int
,
float
,
A
):
with
self
.
subTest
(
filename
=
type_
):
with
self
.
assertRaises
(
TypeError
):
instance
=
type_
()
c
=
LWPCookieJar
(
filename
=
instance
)
def
test_lwp_valueless_cookie
(
self
):
# cookies with no value should be saved and loaded consistently
filename
=
test
.
support
.
TESTFN
...
...
Misc/NEWS.d/next/Library/2019-02-19-19-53-46.bpo-36043.l867v0.rst
0 → 100644
Dosyayı görüntüle @
4b219ce8
:class:`FileCookieJar` supports :term:`path-like object`. Contributed by Stéphane Wirtel
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