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
98147983
Commit
98147983
authored
Jun 14, 2008
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forward port fix for LP #239636 from 2.9 branch.
parent
08cbd196
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
4 deletions
+34
-4
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/webdav/NullResource.py
lib/python/webdav/NullResource.py
+1
-0
lib/python/webdav/tests/testNullResource.py
lib/python/webdav/tests/testNullResource.py
+30
-4
No files found.
doc/CHANGES.txt
View file @
98147983
...
...
@@ -8,6 +8,9 @@ Zope Changes
Bugs fixed
- Launchpad #239636: Ensure that HEAD requests lock an empty body
for NotFound errors.
- Launchpad #229549: Don't ignore 'debug' flag when rendering
page templates (thanks to Eric Steele for the patch).
...
...
lib/python/webdav/NullResource.py
View file @
98147983
...
...
@@ -71,6 +71,7 @@ class NullResource(Persistent, Acquisition.Implicit, Resource):
def
HEAD
(
self
,
REQUEST
,
RESPONSE
):
"""Retrieve resource information without a response message body."""
self
.
dav__init
(
REQUEST
,
RESPONSE
)
RESPONSE
.
setBody
(
''
,
lock
=
True
)
raise
NotFound
,
'The requested resource does not exist.'
# Most methods return 404 (Not Found) for null resources.
...
...
lib/python/webdav/tests/testNullResource.py
View file @
98147983
...
...
@@ -20,20 +20,46 @@ class TestLockNullResource(unittest.TestCase):
class
TestNullResource
(
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
webdav.NullResource
import
NullResource
return
NullResource
def
_makeOne
(
self
,
parent
=
None
,
name
=
'nonesuch'
,
**
kw
):
return
self
.
_getTargetClass
()(
parent
,
name
,
**
kw
)
def
test_z2interfaces
(
self
):
from
Interface.Verify
import
verifyClass
from
webdav.NullResource
import
NullResource
from
webdav.WriteLockInterface
import
WriteLockInterface
verifyClass
(
WriteLockInterface
,
NullResource
)
verifyClass
(
WriteLockInterface
,
self
.
_getTargetClass
()
)
def
test_z3interfaces
(
self
):
from
webdav.interfaces
import
IWriteLock
from
webdav.NullResource
import
NullResource
from
zope.interface.verify
import
verifyClass
verifyClass
(
IWriteLock
,
NullResource
)
verifyClass
(
IWriteLock
,
self
.
_getTargetClass
())
def
test_HEAD_locks_empty_body_before_raising_NotFound
(
self
):
from
zExceptions
import
NotFound
# See https://bugs.launchpad.net/bugs/239636
class
DummyResponse
:
_server_version
=
'Dummy'
# emulate ZServer response
locked
=
False
body
=
None
def
setHeader
(
self
,
*
args
):
pass
def
setBody
(
self
,
body
,
lock
=
False
):
self
.
body
=
body
self
.
locked
=
bool
(
lock
)
nonesuch
=
self
.
_makeOne
()
request
=
{}
response
=
DummyResponse
()
self
.
assertRaises
(
NotFound
,
nonesuch
.
HEAD
,
request
,
response
)
self
.
assertEqual
(
response
.
body
,
''
)
self
.
failUnless
(
response
.
locked
)
def
test_suite
():
return
unittest
.
TestSuite
((
...
...
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