Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
457df02d
Commit
457df02d
authored
8 years ago
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #27466: Change time format returned by http.cookie.time2netscape,
confirming the netscape cookie format.
parent
296aeae6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
1 deletion
+27
-1
Lib/http/cookiejar.py
Lib/http/cookiejar.py
+1
-1
Lib/test/test_http_cookiejar.py
Lib/test/test_http_cookiejar.py
+22
-0
Misc/NEWS
Misc/NEWS
+4
-0
No files found.
Lib/http/cookiejar.py
View file @
457df02d
...
...
@@ -120,7 +120,7 @@ def time2netscape(t=None):
dt
=
datetime
.
datetime
.
utcnow
()
else
:
dt
=
datetime
.
datetime
.
utcfromtimestamp
(
t
)
return
"%s %02d-%s-%04d %02d:%02d:%02d GMT"
%
(
return
"%s
,
%02d-%s-%04d %02d:%02d:%02d GMT"
%
(
DAYS
[
dt
.
weekday
()],
dt
.
day
,
MONTHS
[
dt
.
month
-
1
],
dt
.
year
,
dt
.
hour
,
dt
.
minute
,
dt
.
second
)
...
...
This diff is collapsed.
Click to expand it.
Lib/test/test_http_cookiejar.py
View file @
457df02d
...
...
@@ -31,6 +31,28 @@ class DateTimeTests(unittest.TestCase):
self
.
assertRegex
(
text
,
r"^\
d{
4}-\
d
\d-\
d
\d \
d
\d:\
d
\d:\
d
\dZ$"
,
"bad time2isoz format: %s %s"
%
(
az
,
bz
))
def
test_time2netscape
(
self
):
base
=
1019227000
day
=
24
*
3600
self
.
assertEqual
(
time2netscape
(
base
),
"Fri, 19-Apr-2002 14:36:40 GMT"
)
self
.
assertEqual
(
time2netscape
(
base
+
day
),
"Sat, 20-Apr-2002 14:36:40 GMT"
)
self
.
assertEqual
(
time2netscape
(
base
+
2
*
day
),
"Sun, 21-Apr-2002 14:36:40 GMT"
)
self
.
assertEqual
(
time2netscape
(
base
+
3
*
day
),
"Mon, 22-Apr-2002 14:36:40 GMT"
)
az
=
time2netscape
()
bz
=
time2netscape
(
500000
)
for
text
in
(
az
,
bz
):
# Format "%s, %02d-%s-%04d %02d:%02d:%02d GMT"
self
.
assertRegex
(
text
,
r"[a-zA-Z]{3}, \
d{
2}-[a-zA-Z]{3}-\
d{
4} \
d{
2}:\
d{
2}:\
d{
2} GMT$"
,
"bad time2netscape format: %s %s"
%
(
az
,
bz
))
def
test_http2time
(
self
):
def
parse_date
(
text
):
return
time
.
gmtime
(
http2time
(
text
))[:
6
]
...
...
This diff is collapsed.
Click to expand it.
Misc/NEWS
View file @
457df02d
...
...
@@ -16,6 +16,10 @@ Core and Builtins
Library
-------
- Issue #27466: Change time format returned by http.cookie.time2netscape,
confirming the netscape cookie format and making it consistent with
documentation.
- Issue #26664: Fix activate.fish by removing mis-use of ``$``.
- Issue #22115: Fixed tracing Tkinter variables: trace_vdelete() with wrong
...
...
This diff is collapsed.
Click to expand it.
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