Commit 61df1bb4 authored by Jens Vagelpohl's avatar Jens Vagelpohl

- LP #143946: Provide a more informative error message when a

  WebDAV PUT fails.
parent 034c3c3a
......@@ -181,6 +181,9 @@ Features Added
Bugs Fixed
++++++++++
- LP #143946: Provide a more informative error message when a
WebDAV PUT fails.
- LP #143261: The (very old-fashioned) Zope2.debug interactive request
debugger still referred to the toplevel module ``Zope``, which was
renamed to ``Zope2`` a long time ago.
......
......@@ -166,7 +166,9 @@ class NullResource(Persistent, Implicit, Resource):
try:
parent._verifyObjectPaste(ob.__of__(parent), 0)
except CopyError:
raise Unauthorized, sys.exc_info()[1]
sMsg = 'Unable to create object of class %s in %s: %s' % \
(ob.__class__, repr(parent), sys.exc_info()[1],)
raise Unauthorized, sMsg
# Delegate actual PUT handling to the new object,
# SDS: But just *after* it has been stored.
......
......@@ -48,6 +48,33 @@ class TestNullResource(unittest.TestCase):
self.assertEqual(response.body, '')
self.failUnless(response.locked)
def test_PUT_unauthorized_message(self):
# See https://bugs.launchpad.net/bugs/143946
import ExtensionClass
from OFS.CopySupport import CopyError
from zExceptions import Unauthorized
class DummyRequest:
def get_header(self, header, default=''):
return default
def get(self, name, default=None):
return default
class DummyResponse:
_server_version = 'Dummy' # emulate ZServer response
def setHeader(self, *args):
pass
class DummyParent(ExtensionClass.Base):
def _verifyObjectPaste(self, *args, **kw):
raise CopyError('Bad Boy!')
nonesuch = self._makeOne()
nonesuch.__parent__ = DummyParent()
request = DummyRequest()
response = DummyResponse()
try:
nonesuch.PUT(request, response)
except Unauthorized, e:
self.failUnless(str(e).startswith('Unable to create object'))
def test_suite():
return unittest.TestSuite((
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment