Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
28a89d65
Commit
28a89d65
authored
Apr 26, 2004
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collector #1160: HTTPResponse.expireCookie() potentially didn't
when an 'expires' keyword argument was passed.
parent
c9dcc610
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
6 deletions
+46
-6
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/ZPublisher/HTTPResponse.py
lib/python/ZPublisher/HTTPResponse.py
+6
-6
lib/python/ZPublisher/tests/testHTTPResponse.py
lib/python/ZPublisher/tests/testHTTPResponse.py
+37
-0
No files found.
doc/CHANGES.txt
View file @
28a89d65
...
@@ -105,6 +105,9 @@ Zope Changes
...
@@ -105,6 +105,9 @@ Zope Changes
Bugs fixed
Bugs fixed
- Collector #1160: HTTPResponse.expireCookie() potentially didn't
when an 'expires' keyword argument was passed.
- Collector #1289: Allow ZSQL methods to be edited via WebDAV.
- Collector #1289: Allow ZSQL methods to be edited via WebDAV.
- WebDAV property values were not being properly escaped on
- WebDAV property values were not being properly escaped on
...
...
lib/python/ZPublisher/HTTPResponse.py
View file @
28a89d65
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
##############################################################################
##############################################################################
'''CGI Response Output formatter
'''CGI Response Output formatter
$Id: HTTPResponse.py,v 1.8
0 2004/01/19 19:56:53 Brian
Exp $'''
$Id: HTTPResponse.py,v 1.8
1 2004/04/26 10:12:08 shh
Exp $'''
__version__
=
'$Revision: 1.8
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.8
1
$'
[
11
:
-
2
]
import
types
,
os
,
sys
,
re
import
types
,
os
,
sys
,
re
import
zlib
,
struct
import
zlib
,
struct
...
@@ -500,10 +500,10 @@ class HTTPResponse(BaseResponse):
...
@@ -500,10 +500,10 @@ class HTTPResponse(BaseResponse):
'''
'''
name
=
str
(
name
)
name
=
str
(
name
)
d
ict
=
{
'max_age'
:
0
,
'expires'
:
'Wed, 31-Dec-97 23:59:59 GMT'
}
d
=
kw
.
copy
()
for
k
,
v
in
kw
.
items
():
d
[
'max_age'
]
=
0
dict
[
k
]
=
v
d
[
'expires'
]
=
'Wed, 31-Dec-97 23:59:59 GMT'
apply
(
HTTPResponse
.
setCookie
,
(
self
,
name
,
'deleted'
),
d
ict
)
apply
(
HTTPResponse
.
setCookie
,
(
self
,
name
,
'deleted'
),
d
)
def
setCookie
(
self
,
name
,
value
,
**
kw
):
def
setCookie
(
self
,
name
,
value
,
**
kw
):
'''
\
'''
\
...
...
lib/python/ZPublisher/tests/testHTTPResponse.py
View file @
28a89d65
...
@@ -28,6 +28,43 @@ class HTTPResponseTests(unittest.TestCase):
...
@@ -28,6 +28,43 @@ class HTTPResponseTests(unittest.TestCase):
response
.
setStatus
(
exc_type
)
response
.
setStatus
(
exc_type
)
self
.
assertEqual
(
response
.
status
,
code
)
self
.
assertEqual
(
response
.
status
,
code
)
def
test_setCookie
(
self
):
response
=
self
.
_makeOne
()
response
.
setCookie
(
'foo'
,
'bar'
,
path
=
'/'
)
cookie
=
response
.
cookies
.
get
(
'foo'
,
None
)
self
.
failUnless
(
cookie
)
self
.
assertEqual
(
cookie
.
get
(
'value'
),
'bar'
)
self
.
assertEqual
(
cookie
.
get
(
'path'
),
'/'
)
def
test_expireCookie
(
self
):
response
=
self
.
_makeOne
()
response
.
expireCookie
(
'foo'
,
path
=
'/'
)
cookie
=
response
.
cookies
.
get
(
'foo'
,
None
)
self
.
failUnless
(
cookie
)
self
.
assertEqual
(
cookie
.
get
(
'expires'
),
'Wed, 31-Dec-97 23:59:59 GMT'
)
self
.
assertEqual
(
cookie
.
get
(
'max_age'
),
0
)
self
.
assertEqual
(
cookie
.
get
(
'path'
),
'/'
)
def
test_expireCookie1160
(
self
):
# Verify that the cookie is expired even if an expires kw arg is passed
# http://zope.org/Collectors/Zope/1160
response
=
self
.
_makeOne
()
response
.
expireCookie
(
'foo'
,
path
=
'/'
,
expires
=
'Mon, 22-Mar-2004 17:59 GMT'
,
max_age
=
99
)
cookie
=
response
.
cookies
.
get
(
'foo'
,
None
)
self
.
failUnless
(
cookie
)
self
.
assertEqual
(
cookie
.
get
(
'expires'
),
'Wed, 31-Dec-97 23:59:59 GMT'
)
self
.
assertEqual
(
cookie
.
get
(
'max_age'
),
0
)
self
.
assertEqual
(
cookie
.
get
(
'path'
),
'/'
)
def
test_appendCookie
(
self
):
response
=
self
.
_makeOne
()
response
.
setCookie
(
'foo'
,
'bar'
,
path
=
'/'
)
response
.
appendCookie
(
'foo'
,
'baz'
)
cookie
=
response
.
cookies
.
get
(
'foo'
,
None
)
self
.
failUnless
(
cookie
)
self
.
assertEqual
(
cookie
.
get
(
'value'
),
'bar:baz'
)
self
.
assertEqual
(
cookie
.
get
(
'path'
),
'/'
)
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
HTTPResponseTests
,
'test'
))
suite
.
addTest
(
unittest
.
makeSuite
(
HTTPResponseTests
,
'test'
))
...
...
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